mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fix ziploader for the cornercase of ansible invoking ansible.
* Make ziploader's ansible and ansible.module_utils libraries into namespace packages. * Move __version__ and __author__ from ansible/__init__ to ansible/release.py. This is because namespace packages only load one __init__.py. If that is not the __init__.py with the author and version info then those won't be available. * In ziplaoder, move the version ito ANSIBLE_CONSTANTS. * Change PluginLoader to properly construct the path to the plugins even when namespace packages are present.
This commit is contained in:
@@ -15,3 +15,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Note: Do not add any code to this file. module_utils may be a namespace
|
||||
# package when using Ansible-2.1+ Anything in this file may not be available
|
||||
# if one of the other packages in the namespace is loaded first.
|
||||
|
||||
@@ -219,10 +219,6 @@ except ImportError:
|
||||
|
||||
_literal_eval = literal_eval
|
||||
|
||||
from ansible import __version__
|
||||
# Backwards compat. New code should just import and use __version__
|
||||
ANSIBLE_VERSION = __version__
|
||||
|
||||
# Internal global holding passed in params and constants. This is consulted
|
||||
# in case multiple AnsibleModules are created. Otherwise each AnsibleModule
|
||||
# would attempt to read from stdin. Other code should not use this directly
|
||||
|
||||
@@ -32,7 +32,6 @@ import os
|
||||
import re
|
||||
from uuid import UUID
|
||||
|
||||
from ansible import __version__
|
||||
from ansible.module_utils.basic import BOOLEANS
|
||||
|
||||
FINAL_STATUSES = ('ACTIVE', 'ERROR')
|
||||
@@ -264,7 +263,7 @@ def rax_required_together():
|
||||
|
||||
def setup_rax_module(module, rax_module, region_required=True):
|
||||
"""Set up pyrax in a standard way for all modules"""
|
||||
rax_module.USER_AGENT = 'ansible/%s %s' % (__version__,
|
||||
rax_module.USER_AGENT = 'ansible/%s %s' % (module.constants['ANSIBLE_VERSION'],
|
||||
rax_module.USER_AGENT)
|
||||
|
||||
api_key = module.params.get('api_key')
|
||||
|
||||
Reference in New Issue
Block a user