diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 650f5e4373..b2a565da39 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -1,46 +1,131 @@ --- action_groups: - tower: - - tower_credential_input_source - - tower_credential - - tower_credential_type - - tower_group - - tower_host - - tower_inventory - - tower_inventory_source - - tower_job_cancel - - tower_job_launch - - tower_job_list - - tower_job_template - - tower_job_wait - - tower_label - - tower_license - - tower_notification - - tower_organization - - tower_project - - tower_role - - tower_schedule - - tower_settings - - tower_team - - tower_token - - tower_user - - tower_workflow_job_template_node - - tower_workflow_job_template - - tower_workflow_launch + controller: + - credential_input_source + - credential + - credential_type + - group + - host + - inventory + - inventory_source + - job_cancel + - job_launch + - job_list + - job_template + - job_wait + - label + - license + - notification + - organization + - project + - role + - schedule + - settings + - team + - token + - user + - workflow_job_template_node + - workflow_job_template + - workflow_launch plugin_routing: + inventory: + tower: + redirect: awx.awx.controller + lookup: + tower_api: + redirect: awx.awx.controller_api + tower_schedule_rrule: + redirect: awx.awx.schedule_rrule modules: + tower_job_list: + redirect: job_list + tower_job_launch: + redirect: job_launch + tower_workflow_job_template: + redirect: workflow_job_template + tower_team: + redirect: team + tower_job_wait: + redirect: job_wait + tower_application: + redirect: application + tower_ad_hoc_command_wait: + redirect: ad_hoc_command_wait + tower_credential: + redirect: credential + tower_label: + redirect: label + tower_group: + redirect: group + tower_host: + redirect: host + tower_schedule: + redirect: schedule + tower_role: + redirect: role + tower_ad_hoc_command: + redirect: ad_hoc_command + tower_execution_environment: + redirect: execution_environment + tower_inventory_source_update: + redirect: inventory_source_update + tower_instance_group: + redirect: instance_group + tower_settings: + redirect: settings + tower_meta: + redirect: meta + tower_export: + redirect: export + tower_ad_hoc_command_cancel: + redirect: ad_hoc_command_cancel + tower_inventory_source: + redirect: inventory_source + tower_user: + redirect: user + tower_workflow_launch: + redirect: workflow_launch + tower_project: + redirect: project + tower_token: + redirect: token + tower_credential_type: + redirect: credential_type + tower_license: + redirect: license + tower_project_update: + redirect: project_update + tower_notification_template: + redirect: notification_template + tower_organization: + redirect: organization + tower_job_template: + redirect: job_template + tower_workflow_job_template_node: + redirect: workflow_job_template_node + tower_job_cancel: + redirect: job_cancel + tower_import: + redirect: import + tower_credential_input_source: + redirect: credential_input_source + tower_inventory: + redirect: inventory tower_receive: + redirect: receive deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_send: + redirect: send deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_workflow_template: + redirect: workflow_template deprecation: removal_date: TBD warning_text: see plugin documentation for details tower_notification: - redirect: tower_notification_template + redirect: notification_template diff --git a/awx_collection/plugins/inventory/tower.py b/awx_collection/plugins/inventory/controller.py similarity index 96% rename from awx_collection/plugins/inventory/tower.py rename to awx_collection/plugins/inventory/controller.py index b90f7f782c..5c14817707 100644 --- a/awx_collection/plugins/inventory/tower.py +++ b/awx_collection/plugins/inventory/controller.py @@ -72,7 +72,7 @@ from ansible.errors import AnsibleParserError, AnsibleOptionsError from ansible.plugins.inventory import BaseInventoryPlugin from ansible.config.manager import ensure_type -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def handle_error(**kwargs): @@ -104,12 +104,12 @@ class InventoryModule(BaseInventoryPlugin): # Defer processing of params to logic shared with the modules module_params = {} - for plugin_param, module_param in TowerAPIModule.short_params.items(): + for plugin_param, module_param in ControllerAPIModule.short_params.items(): opt_val = self.get_option(plugin_param) if opt_val is not None: module_params[module_param] = opt_val - module = TowerAPIModule(argument_spec={}, direct_params=module_params, error_callback=handle_error, warn_callback=self.warn_callback) + module = ControllerAPIModule(argument_spec={}, direct_params=module_params, error_callback=handle_error, warn_callback=self.warn_callback) # validate type of inventory_id because we allow two types as special case inventory_id = self.get_option('inventory_id') diff --git a/awx_collection/plugins/lookup/tower_api.py b/awx_collection/plugins/lookup/controller_api.py similarity index 95% rename from awx_collection/plugins/lookup/tower_api.py rename to awx_collection/plugins/lookup/controller_api.py index c38b33d139..ee55a200ca 100644 --- a/awx_collection/plugins/lookup/tower_api.py +++ b/awx_collection/plugins/lookup/controller_api.py @@ -120,7 +120,7 @@ from ansible.plugins.lookup import LookupBase from ansible.errors import AnsibleError from ansible.module_utils._text import to_native from ansible.utils.display import Display -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule class LookupModule(LookupBase): @@ -140,13 +140,13 @@ class LookupModule(LookupBase): # Defer processing of params to logic shared with the modules module_params = {} - for plugin_param, module_param in TowerAPIModule.short_params.items(): + for plugin_param, module_param in ControllerAPIModule.short_params.items(): opt_val = self.get_option(plugin_param) if opt_val is not None: module_params[module_param] = opt_val # Create our module - module = TowerAPIModule(argument_spec={}, direct_params=module_params, error_callback=self.handle_error, warn_callback=self.warn_callback) + module = ControllerAPIModule(argument_spec={}, direct_params=module_params, error_callback=self.handle_error, warn_callback=self.warn_callback) response = module.get_endpoint(terms[0], data=self.get_option('query_params', {})) diff --git a/awx_collection/plugins/lookup/tower_schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py similarity index 100% rename from awx_collection/plugins/lookup/tower_schedule_rrule.py rename to awx_collection/plugins/lookup/schedule_rrule.py diff --git a/awx_collection/plugins/module_utils/tower_awxkit.py b/awx_collection/plugins/module_utils/awxkit.py similarity index 89% rename from awx_collection/plugins/module_utils/tower_awxkit.py rename to awx_collection/plugins/module_utils/awxkit.py index 83bb2990cd..31902e6b15 100644 --- a/awx_collection/plugins/module_utils/tower_awxkit.py +++ b/awx_collection/plugins/module_utils/awxkit.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -from .tower_module import TowerModule +from .controller_module import ControllerModule from ansible.module_utils.basic import missing_required_lib try: @@ -15,14 +15,14 @@ except ImportError: HAS_AWX_KIT = False -class TowerAWXKitModule(TowerModule): +class ControllerAWXKitModule(ControllerModule): connection = None apiV2Ref = None def __init__(self, argument_spec, **kwargs): kwargs['supports_check_mode'] = False - super(TowerAWXKitModule, self).__init__(argument_spec=argument_spec, **kwargs) + super(ControllerAWXKitModule, self).__init__(argument_spec=argument_spec, **kwargs) # Die if we don't have AWX_KIT installed if not HAS_AWX_KIT: diff --git a/awx_collection/plugins/module_utils/tower_api.py b/awx_collection/plugins/module_utils/controller_api.py similarity index 98% rename from awx_collection/plugins/module_utils/tower_api.py rename to awx_collection/plugins/module_utils/controller_api.py index ab1b9083a7..0d3aae956e 100644 --- a/awx_collection/plugins/module_utils/tower_api.py +++ b/awx_collection/plugins/module_utils/controller_api.py @@ -2,7 +2,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -from .tower_module import TowerModule +from .controller_module import ControllerModule from ansible.module_utils.urls import Request, SSLValidationError, ConnectionError from ansible.module_utils.six import PY2 from ansible.module_utils.six.moves.urllib.error import HTTPError @@ -12,8 +12,8 @@ import time from json import loads, dumps -class TowerAPIModule(TowerModule): - # TODO: Move the collection version check into tower_module.py +class ControllerAPIModule(ControllerModule): + # TODO: Move the collection version check into controller_module.py # This gets set by the make process so whatever is in here is irrelevant _COLLECTION_VERSION = "0.0.1-devel" _COLLECTION_TYPE = "awx" @@ -30,7 +30,7 @@ class TowerAPIModule(TowerModule): def __init__(self, argument_spec, direct_params=None, error_callback=None, warn_callback=None, **kwargs): kwargs['supports_check_mode'] = True - super(TowerAPIModule, self).__init__( + super(ControllerAPIModule, self).__init__( argument_spec=argument_spec, direct_params=direct_params, error_callback=error_callback, warn_callback=warn_callback, **kwargs ) self.session = Request(cookies=CookieJar(), validate_certs=self.verify_ssl) @@ -47,14 +47,14 @@ class TowerAPIModule(TowerModule): @staticmethod def get_name_field_from_endpoint(endpoint): - return TowerAPIModule.IDENTITY_FIELDS.get(endpoint, 'name') + return ControllerAPIModule.IDENTITY_FIELDS.get(endpoint, 'name') def get_item_name(self, item, allow_unknown=False): if item: if 'name' in item: return item['name'] - for field_name in TowerAPIModule.IDENTITY_FIELDS.values(): + for field_name in ControllerAPIModule.IDENTITY_FIELDS.values(): if field_name in item: return item[field_name] @@ -544,13 +544,13 @@ class TowerAPIModule(TowerModule): """ if isinstance(obj, dict): for val in obj.values(): - if TowerAPIModule.has_encrypted_values(val): + if ControllerAPIModule.has_encrypted_values(val): return True elif isinstance(obj, list): for val in obj: - if TowerAPIModule.has_encrypted_values(val): + if ControllerAPIModule.has_encrypted_values(val): return True - elif obj == TowerAPIModule.ENCRYPTED_STRING: + elif obj == ControllerAPIModule.ENCRYPTED_STRING: return True return False @@ -565,11 +565,11 @@ class TowerAPIModule(TowerModule): if set(old_field.keys()) != set(new_field.keys()): return False for key in new_field.keys(): - if not TowerAPIModule.fields_could_be_same(old_field[key], new_field[key]): + if not ControllerAPIModule.fields_could_be_same(old_field[key], new_field[key]): return False return True # all sub-fields are either equal or could be equal else: - if old_field == TowerAPIModule.ENCRYPTED_STRING: + if old_field == ControllerAPIModule.ENCRYPTED_STRING: return True return bool(new_field == old_field) diff --git a/awx_collection/plugins/module_utils/tower_module.py b/awx_collection/plugins/module_utils/controller_module.py similarity index 96% rename from awx_collection/plugins/module_utils/tower_module.py rename to awx_collection/plugins/module_utils/controller_module.py index 60cc44efa5..1f2bed7c33 100644 --- a/awx_collection/plugins/module_utils/tower_module.py +++ b/awx_collection/plugins/module_utils/controller_module.py @@ -29,7 +29,7 @@ class ItemNotDefined(Exception): pass -class TowerModule(AnsibleModule): +class ControllerModule(AnsibleModule): url = None AUTH_ARGSPEC = dict( tower_host=dict(required=False, fallback=(env_fallback, ['TOWER_HOST'])), @@ -60,7 +60,7 @@ class TowerModule(AnsibleModule): def __init__(self, argument_spec=None, direct_params=None, error_callback=None, warn_callback=None, **kwargs): full_argspec = {} - full_argspec.update(TowerModule.AUTH_ARGSPEC) + full_argspec.update(ControllerModule.AUTH_ARGSPEC) full_argspec.update(argument_spec) kwargs['supports_check_mode'] = True @@ -72,7 +72,7 @@ class TowerModule(AnsibleModule): if direct_params is not None: self.params = direct_params else: - super(TowerModule, self).__init__(argument_spec=full_argspec, **kwargs) + super(ControllerModule, self).__init__(argument_spec=full_argspec, **kwargs) self.load_config_files() @@ -242,15 +242,15 @@ class TowerModule(AnsibleModule): if self.error_callback: self.error_callback(**kwargs) else: - super(TowerModule, self).fail_json(**kwargs) + super(ControllerModule, self).fail_json(**kwargs) def exit_json(self, **kwargs): # Try to log out if we are authenticated self.logout() - super(TowerModule, self).exit_json(**kwargs) + super(ControllerModule, self).exit_json(**kwargs) def warn(self, warning): if self.warn_callback is not None: self.warn_callback(warning) else: - super(TowerModule, self).warn(warning) + super(ControllerModule, self).warn(warning) diff --git a/awx_collection/plugins/module_utils/tower_legacy.py b/awx_collection/plugins/module_utils/legacy.py similarity index 100% rename from awx_collection/plugins/module_utils/tower_legacy.py rename to awx_collection/plugins/module_utils/legacy.py diff --git a/awx_collection/plugins/modules/tower_ad_hoc_command.py b/awx_collection/plugins/modules/ad_hoc_command.py similarity index 97% rename from awx_collection/plugins/modules/tower_ad_hoc_command.py rename to awx_collection/plugins/modules/ad_hoc_command.py index 3926df9471..97f2d1072f 100644 --- a/awx_collection/plugins/modules/tower_ad_hoc_command.py +++ b/awx_collection/plugins/modules/ad_hoc_command.py @@ -111,7 +111,7 @@ status: sample: pending ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -135,7 +135,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters inventory = module.params.get('inventory') diff --git a/awx_collection/plugins/modules/tower_ad_hoc_command_cancel.py b/awx_collection/plugins/modules/ad_hoc_command_cancel.py similarity index 96% rename from awx_collection/plugins/modules/tower_ad_hoc_command_cancel.py rename to awx_collection/plugins/modules/ad_hoc_command_cancel.py index c909250e4f..400ef4af9b 100644 --- a/awx_collection/plugins/modules/tower_ad_hoc_command_cancel.py +++ b/awx_collection/plugins/modules/ad_hoc_command_cancel.py @@ -62,7 +62,7 @@ id: import time -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -75,7 +75,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters command_id = module.params.get('command_id') diff --git a/awx_collection/plugins/modules/tower_ad_hoc_command_wait.py b/awx_collection/plugins/modules/ad_hoc_command_wait.py similarity index 96% rename from awx_collection/plugins/modules/tower_ad_hoc_command_wait.py rename to awx_collection/plugins/modules/ad_hoc_command_wait.py index 13f890c33e..21f4e9b348 100644 --- a/awx_collection/plugins/modules/tower_ad_hoc_command_wait.py +++ b/awx_collection/plugins/modules/ad_hoc_command_wait.py @@ -82,7 +82,7 @@ status: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -94,7 +94,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters command_id = module.params.get('command_id') diff --git a/awx_collection/plugins/modules/tower_application.py b/awx_collection/plugins/modules/application.py similarity index 97% rename from awx_collection/plugins/modules/tower_application.py rename to awx_collection/plugins/modules/application.py index 5841c74318..8fcf4f79dd 100644 --- a/awx_collection/plugins/modules/tower_application.py +++ b/awx_collection/plugins/modules/application.py @@ -91,7 +91,7 @@ EXAMPLES = ''' import time -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -108,7 +108,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_credential.py b/awx_collection/plugins/modules/credential.py similarity index 98% rename from awx_collection/plugins/modules/tower_credential.py rename to awx_collection/plugins/modules/credential.py index ad09769d2c..46e2c712dd 100644 --- a/awx_collection/plugins/modules/tower_credential.py +++ b/awx_collection/plugins/modules/credential.py @@ -289,7 +289,7 @@ EXAMPLES = ''' organization: Foo ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule KIND_CHOICES = { 'aws': 'Amazon Web Services', @@ -378,7 +378,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']]) + module = ControllerAPIModule(argument_spec=argument_spec, required_one_of=[['kind', 'credential_type']]) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_credential_input_source.py b/awx_collection/plugins/modules/credential_input_source.py similarity index 97% rename from awx_collection/plugins/modules/tower_credential_input_source.py rename to awx_collection/plugins/modules/credential_input_source.py index 2fa32d612c..9e4303a5bd 100644 --- a/awx_collection/plugins/modules/tower_credential_input_source.py +++ b/awx_collection/plugins/modules/credential_input_source.py @@ -69,7 +69,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -84,7 +84,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters description = module.params.get('description') diff --git a/awx_collection/plugins/modules/tower_credential_type.py b/awx_collection/plugins/modules/credential_type.py similarity index 97% rename from awx_collection/plugins/modules/tower_credential_type.py rename to awx_collection/plugins/modules/credential_type.py index d960f47603..af0869d2c4 100644 --- a/awx_collection/plugins/modules/tower_credential_type.py +++ b/awx_collection/plugins/modules/credential_type.py @@ -80,7 +80,7 @@ EXAMPLES = ''' RETURN = ''' # ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule KIND_CHOICES = {'ssh': 'Machine', 'vault': 'Ansible Vault', 'net': 'Network', 'scm': 'Source Control', 'cloud': 'Lots of others', 'insights': 'Insights'} @@ -97,7 +97,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_execution_environment.py b/awx_collection/plugins/modules/execution_environment.py similarity index 96% rename from awx_collection/plugins/modules/tower_execution_environment.py rename to awx_collection/plugins/modules/execution_environment.py index 4200016132..fc9ecc19a0 100644 --- a/awx_collection/plugins/modules/tower_execution_environment.py +++ b/awx_collection/plugins/modules/execution_environment.py @@ -67,7 +67,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -84,7 +84,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_export.py b/awx_collection/plugins/modules/export.py similarity index 96% rename from awx_collection/plugins/modules/tower_export.py rename to awx_collection/plugins/modules/export.py index 4e6b3b9a3a..370ff8e685 100644 --- a/awx_collection/plugins/modules/tower_export.py +++ b/awx_collection/plugins/modules/export.py @@ -99,7 +99,7 @@ EXAMPLES = ''' from os import environ import logging from ansible.module_utils.six.moves import StringIO -from ..module_utils.tower_awxkit import TowerAWXKitModule +from ..module_utils.awxkit import ControllerAWXKitModule try: from awxkit.api.pages.api import EXPORTABLE_RESOURCES @@ -114,12 +114,12 @@ def main(): all=dict(type='bool', default=False), ) - # We are not going to raise an error here because the __init__ method of TowerAWXKitModule will do that for us + # We are not going to raise an error here because the __init__ method of ControllerAWXKitModule will do that for us if HAS_EXPORTABLE_RESOURCES: for resource in EXPORTABLE_RESOURCES: argument_spec[resource] = dict(type='str') - module = TowerAWXKitModule(argument_spec=argument_spec) + module = ControllerAWXKitModule(argument_spec=argument_spec) if not HAS_EXPORTABLE_RESOURCES: module.fail_json(msg="Your version of awxkit does not have import/export") diff --git a/awx_collection/plugins/modules/tower_group.py b/awx_collection/plugins/modules/group.py similarity index 97% rename from awx_collection/plugins/modules/tower_group.py rename to awx_collection/plugins/modules/group.py index 4c1674bb7c..f7785da2be 100644 --- a/awx_collection/plugins/modules/tower_group.py +++ b/awx_collection/plugins/modules/group.py @@ -99,7 +99,7 @@ EXAMPLES = ''' preserve_existing_children: True ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -119,7 +119,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_host.py b/awx_collection/plugins/modules/host.py similarity index 96% rename from awx_collection/plugins/modules/tower_host.py rename to awx_collection/plugins/modules/host.py index c56d5f877d..d5e711dd93 100644 --- a/awx_collection/plugins/modules/tower_host.py +++ b/awx_collection/plugins/modules/host.py @@ -71,7 +71,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -88,7 +88,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_import.py b/awx_collection/plugins/modules/import.py similarity index 95% rename from awx_collection/plugins/modules/tower_import.py rename to awx_collection/plugins/modules/import.py index 76169f88ba..89142532ad 100644 --- a/awx_collection/plugins/modules/tower_import.py +++ b/awx_collection/plugins/modules/import.py @@ -48,7 +48,7 @@ EXAMPLES = ''' assets: "{{ lookup('file', 'org.json') | from_json() }}" ''' -from ..module_utils.tower_awxkit import TowerAWXKitModule +from ..module_utils.awxkit import ControllerAWXKitModule # These two lines are not needed if awxkit changes to do programatic notifications on issues from ansible.module_utils.six.moves import StringIO @@ -66,7 +66,7 @@ except ImportError: def main(): argument_spec = dict(assets=dict(type='dict', required=True)) - module = TowerAWXKitModule(argument_spec=argument_spec, supports_check_mode=False) + module = ControllerAWXKitModule(argument_spec=argument_spec, supports_check_mode=False) assets = module.params.get('assets') diff --git a/awx_collection/plugins/modules/tower_instance_group.py b/awx_collection/plugins/modules/instance_group.py similarity index 97% rename from awx_collection/plugins/modules/tower_instance_group.py rename to awx_collection/plugins/modules/instance_group.py index 4ec76174d3..65f0d27ee8 100644 --- a/awx_collection/plugins/modules/tower_instance_group.py +++ b/awx_collection/plugins/modules/instance_group.py @@ -80,7 +80,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -99,7 +99,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_inventory.py b/awx_collection/plugins/modules/inventory.py similarity index 98% rename from awx_collection/plugins/modules/tower_inventory.py rename to awx_collection/plugins/modules/inventory.py index 3e9f3613df..25b75358f3 100644 --- a/awx_collection/plugins/modules/tower_inventory.py +++ b/awx_collection/plugins/modules/inventory.py @@ -95,7 +95,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -115,7 +115,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_inventory_source.py b/awx_collection/plugins/modules/inventory_source.py similarity index 98% rename from awx_collection/plugins/modules/tower_inventory_source.py rename to awx_collection/plugins/modules/inventory_source.py index 4cb1581ec9..4ab2dd192f 100644 --- a/awx_collection/plugins/modules/tower_inventory_source.py +++ b/awx_collection/plugins/modules/inventory_source.py @@ -150,7 +150,7 @@ EXAMPLES = ''' private: false ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule from json import dumps @@ -189,7 +189,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_inventory_source_update.py b/awx_collection/plugins/modules/inventory_source_update.py similarity index 97% rename from awx_collection/plugins/modules/tower_inventory_source_update.py rename to awx_collection/plugins/modules/inventory_source_update.py index 9026720fd5..703c3ca4e7 100644 --- a/awx_collection/plugins/modules/tower_inventory_source_update.py +++ b/awx_collection/plugins/modules/inventory_source_update.py @@ -83,7 +83,7 @@ status: sample: pending ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -98,7 +98,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_job_cancel.py b/awx_collection/plugins/modules/job_cancel.py similarity index 95% rename from awx_collection/plugins/modules/tower_job_cancel.py rename to awx_collection/plugins/modules/job_cancel.py index 4e1fdbf620..c56a4efa3f 100644 --- a/awx_collection/plugins/modules/tower_job_cancel.py +++ b/awx_collection/plugins/modules/job_cancel.py @@ -49,7 +49,7 @@ id: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -60,7 +60,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters job_id = module.params.get('job_id') diff --git a/awx_collection/plugins/modules/tower_job_launch.py b/awx_collection/plugins/modules/job_launch.py similarity index 98% rename from awx_collection/plugins/modules/tower_job_launch.py rename to awx_collection/plugins/modules/job_launch.py index 801a4cfc85..e211d5654a 100644 --- a/awx_collection/plugins/modules/tower_job_launch.py +++ b/awx_collection/plugins/modules/job_launch.py @@ -145,7 +145,7 @@ status: sample: pending ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -171,7 +171,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) optional_args = {} # Extract our parameters diff --git a/awx_collection/plugins/modules/tower_job_list.py b/awx_collection/plugins/modules/job_list.py similarity index 97% rename from awx_collection/plugins/modules/tower_job_list.py rename to awx_collection/plugins/modules/job_list.py index 0bbb79c7e1..43a454a5da 100644 --- a/awx_collection/plugins/modules/tower_job_list.py +++ b/awx_collection/plugins/modules/job_list.py @@ -79,7 +79,7 @@ results: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -92,7 +92,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, mutually_exclusive=[ ('page', 'all_pages'), diff --git a/awx_collection/plugins/modules/tower_job_template.py b/awx_collection/plugins/modules/job_template.py similarity index 99% rename from awx_collection/plugins/modules/tower_job_template.py rename to awx_collection/plugins/modules/job_template.py index 09387c6386..8cf6ae8b9a 100644 --- a/awx_collection/plugins/modules/tower_job_template.py +++ b/awx_collection/plugins/modules/job_template.py @@ -343,7 +343,7 @@ EXAMPLES = ''' state: "present" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -417,7 +417,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_job_wait.py b/awx_collection/plugins/modules/job_wait.py similarity index 97% rename from awx_collection/plugins/modules/tower_job_wait.py rename to awx_collection/plugins/modules/job_wait.py index 3c77e3f354..52ab4a8dd4 100644 --- a/awx_collection/plugins/modules/tower_job_wait.py +++ b/awx_collection/plugins/modules/job_wait.py @@ -97,7 +97,7 @@ status: ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -112,7 +112,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters job_id = module.params.get('job_id') diff --git a/awx_collection/plugins/modules/tower_label.py b/awx_collection/plugins/modules/label.py similarity index 95% rename from awx_collection/plugins/modules/tower_label.py rename to awx_collection/plugins/modules/label.py index 52a67ed64f..e231f4848b 100644 --- a/awx_collection/plugins/modules/tower_label.py +++ b/awx_collection/plugins/modules/label.py @@ -53,7 +53,7 @@ EXAMPLES = ''' organization: My Organization ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -66,7 +66,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_license.py b/awx_collection/plugins/modules/license.py similarity index 96% rename from awx_collection/plugins/modules/tower_license.py rename to awx_collection/plugins/modules/license.py index 90439b0a08..185aa7dfc7 100644 --- a/awx_collection/plugins/modules/tower_license.py +++ b/awx_collection/plugins/modules/license.py @@ -44,12 +44,12 @@ EXAMPLES = ''' ''' import base64 -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=dict( manifest=dict(type='str', required=True), force=dict(type='bool', required=False), diff --git a/awx_collection/plugins/modules/tower_meta.py b/awx_collection/plugins/modules/meta.py similarity index 94% rename from awx_collection/plugins/modules/tower_meta.py rename to awx_collection/plugins/modules/meta.py index a62c3f5113..cc742f20de 100644 --- a/awx_collection/plugins/modules/tower_meta.py +++ b/awx_collection/plugins/modules/meta.py @@ -61,11 +61,11 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): - module = TowerAPIModule(argument_spec={}) + module = ControllerAPIModule(argument_spec={}) namespace = {'awx': 'awx', 'tower': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown') namespace_name = '{0}.{1}'.format(namespace, module._COLLECTION_TYPE) module.exit_json(prefix=namespace_name, name=module._COLLECTION_TYPE, namespace=namespace, version=module._COLLECTION_VERSION) diff --git a/awx_collection/plugins/modules/tower_notification_template.py b/awx_collection/plugins/modules/notification_template.py similarity index 99% rename from awx_collection/plugins/modules/tower_notification_template.py rename to awx_collection/plugins/modules/notification_template.py index 6d2af69a97..11a24abe3b 100644 --- a/awx_collection/plugins/modules/tower_notification_template.py +++ b/awx_collection/plugins/modules/notification_template.py @@ -313,7 +313,7 @@ EXAMPLES = ''' RETURN = ''' # ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule OLD_INPUT_NAMES = ( 'username', @@ -384,7 +384,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_organization.py b/awx_collection/plugins/modules/organization.py similarity index 98% rename from awx_collection/plugins/modules/tower_organization.py rename to awx_collection/plugins/modules/organization.py index a919e53c67..b7206e4a1d 100644 --- a/awx_collection/plugins/modules/tower_organization.py +++ b/awx_collection/plugins/modules/organization.py @@ -109,7 +109,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -130,7 +130,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_project.py b/awx_collection/plugins/modules/project.py similarity index 99% rename from awx_collection/plugins/modules/tower_project.py rename to awx_collection/plugins/modules/project.py index a3f7820b81..98e7e34691 100644 --- a/awx_collection/plugins/modules/tower_project.py +++ b/awx_collection/plugins/modules/project.py @@ -199,7 +199,7 @@ EXAMPLES = ''' import time -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def wait_for_project_update(module, last_request): @@ -280,7 +280,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_project_update.py b/awx_collection/plugins/modules/project_update.py similarity index 97% rename from awx_collection/plugins/modules/tower_project_update.py rename to awx_collection/plugins/modules/project_update.py index 796f910df7..0371343734 100644 --- a/awx_collection/plugins/modules/tower_project_update.py +++ b/awx_collection/plugins/modules/project_update.py @@ -77,7 +77,7 @@ EXAMPLES = ''' wait: False ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json import time @@ -93,7 +93,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_receive.py b/awx_collection/plugins/modules/receive.py similarity index 100% rename from awx_collection/plugins/modules/tower_receive.py rename to awx_collection/plugins/modules/receive.py diff --git a/awx_collection/plugins/modules/tower_role.py b/awx_collection/plugins/modules/role.py similarity index 98% rename from awx_collection/plugins/modules/tower_role.py rename to awx_collection/plugins/modules/role.py index 2b73f8eab4..5cfda7fa48 100644 --- a/awx_collection/plugins/modules/tower_role.py +++ b/awx_collection/plugins/modules/role.py @@ -148,7 +148,7 @@ EXAMPLES = ''' state: present ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -194,7 +194,7 @@ def main(): state=dict(choices=['present', 'absent'], default='present'), ) - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) role_type = module.params.pop('role') role_field = role_type + '_role' diff --git a/awx_collection/plugins/modules/tower_schedule.py b/awx_collection/plugins/modules/schedule.py similarity index 98% rename from awx_collection/plugins/modules/tower_schedule.py rename to awx_collection/plugins/modules/schedule.py index 921b8e8761..33f1a4b4bb 100644 --- a/awx_collection/plugins/modules/tower_schedule.py +++ b/awx_collection/plugins/modules/schedule.py @@ -135,7 +135,7 @@ EXAMPLES = ''' register: result ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -160,7 +160,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters rrule = module.params.get('rrule') diff --git a/awx_collection/plugins/modules/tower_send.py b/awx_collection/plugins/modules/send.py similarity index 100% rename from awx_collection/plugins/modules/tower_send.py rename to awx_collection/plugins/modules/send.py diff --git a/awx_collection/plugins/modules/tower_settings.py b/awx_collection/plugins/modules/settings.py similarity index 98% rename from awx_collection/plugins/modules/tower_settings.py rename to awx_collection/plugins/modules/settings.py index 18531a28d7..4cfbc2aae3 100644 --- a/awx_collection/plugins/modules/tower_settings.py +++ b/awx_collection/plugins/modules/settings.py @@ -69,7 +69,7 @@ EXAMPLES = ''' last_name: "surname" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule try: import yaml @@ -107,7 +107,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, required_one_of=[['name', 'settings']], mutually_exclusive=[['name', 'settings']], diff --git a/awx_collection/plugins/modules/tower_team.py b/awx_collection/plugins/modules/team.py similarity index 96% rename from awx_collection/plugins/modules/tower_team.py rename to awx_collection/plugins/modules/team.py index a060223f61..d47e41d79a 100644 --- a/awx_collection/plugins/modules/tower_team.py +++ b/awx_collection/plugins/modules/team.py @@ -59,7 +59,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -73,7 +73,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_token.py b/awx_collection/plugins/modules/token.py similarity index 98% rename from awx_collection/plugins/modules/tower_token.py rename to awx_collection/plugins/modules/token.py index 541a6c7dd1..85ac7f04c8 100644 --- a/awx_collection/plugins/modules/tower_token.py +++ b/awx_collection/plugins/modules/token.py @@ -116,7 +116,7 @@ tower_token: returned: on successful create ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def return_token(module, last_response): @@ -142,7 +142,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, mutually_exclusive=[ ('existing_token', 'existing_token_id'), diff --git a/awx_collection/plugins/modules/tower_user.py b/awx_collection/plugins/modules/user.py similarity index 97% rename from awx_collection/plugins/modules/tower_user.py rename to awx_collection/plugins/modules/user.py index 871ca872ac..d1ab5841ea 100644 --- a/awx_collection/plugins/modules/tower_user.py +++ b/awx_collection/plugins/modules/user.py @@ -107,7 +107,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -125,7 +125,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters username = module.params.get('username') diff --git a/awx_collection/plugins/modules/tower_workflow_approval.py b/awx_collection/plugins/modules/workflow_approval.py similarity index 96% rename from awx_collection/plugins/modules/tower_workflow_approval.py rename to awx_collection/plugins/modules/workflow_approval.py index 3bbd318db6..c4de175b80 100644 --- a/awx_collection/plugins/modules/tower_workflow_approval.py +++ b/awx_collection/plugins/modules/workflow_approval.py @@ -77,7 +77,7 @@ RETURN = """ """ -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -91,7 +91,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters workflow_job_id = module.params.get("workflow_job_id") diff --git a/awx_collection/plugins/modules/tower_workflow_job_template.py b/awx_collection/plugins/modules/workflow_job_template.py similarity index 99% rename from awx_collection/plugins/modules/tower_workflow_job_template.py rename to awx_collection/plugins/modules/workflow_job_template.py index 061b3912be..3f9c7aa183 100644 --- a/awx_collection/plugins/modules/tower_workflow_job_template.py +++ b/awx_collection/plugins/modules/workflow_job_template.py @@ -455,7 +455,7 @@ EXAMPLES = ''' ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -689,7 +689,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters name = module.params.get('name') diff --git a/awx_collection/plugins/modules/tower_workflow_job_template_node.py b/awx_collection/plugins/modules/workflow_job_template_node.py similarity index 99% rename from awx_collection/plugins/modules/tower_workflow_job_template_node.py rename to awx_collection/plugins/modules/workflow_job_template_node.py index b878af8d53..bb05449bbf 100644 --- a/awx_collection/plugins/modules/tower_workflow_job_template_node.py +++ b/awx_collection/plugins/modules/workflow_job_template_node.py @@ -224,7 +224,7 @@ EXAMPLES = ''' - my-third-node ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule def main(): @@ -259,7 +259,7 @@ def main(): ] # Create a module for ourselves - module = TowerAPIModule( + module = ControllerAPIModule( argument_spec=argument_spec, mutually_exclusive=mutually_exclusive, required_if=required_if, diff --git a/awx_collection/plugins/modules/tower_workflow_launch.py b/awx_collection/plugins/modules/workflow_launch.py similarity index 98% rename from awx_collection/plugins/modules/tower_workflow_launch.py rename to awx_collection/plugins/modules/workflow_launch.py index cee0c2c649..40f8c37717 100644 --- a/awx_collection/plugins/modules/tower_workflow_launch.py +++ b/awx_collection/plugins/modules/workflow_launch.py @@ -90,7 +90,7 @@ EXAMPLES = ''' wait: False ''' -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import json @@ -109,7 +109,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) optional_args = {} # Extract our parameters diff --git a/awx_collection/plugins/modules/tower_workflow_node_wait.py b/awx_collection/plugins/modules/workflow_node_wait.py similarity index 95% rename from awx_collection/plugins/modules/tower_workflow_node_wait.py rename to awx_collection/plugins/modules/workflow_node_wait.py index 1510b4f43f..2e2e06ee35 100644 --- a/awx_collection/plugins/modules/tower_workflow_node_wait.py +++ b/awx_collection/plugins/modules/workflow_node_wait.py @@ -69,7 +69,7 @@ RETURN = """ """ -from ..module_utils.tower_api import TowerAPIModule +from ..module_utils.controller_api import ControllerAPIModule import time @@ -83,7 +83,7 @@ def main(): ) # Create a module for ourselves - module = TowerAPIModule(argument_spec=argument_spec) + module = ControllerAPIModule(argument_spec=argument_spec) # Extract our parameters workflow_job_id = module.params.get("workflow_job_id") diff --git a/awx_collection/plugins/modules/tower_workflow_template.py b/awx_collection/plugins/modules/workflow_template.py similarity index 100% rename from awx_collection/plugins/modules/tower_workflow_template.py rename to awx_collection/plugins/modules/workflow_template.py diff --git a/awx_collection/test/awx/conftest.py b/awx_collection/test/awx/conftest.py index 8b5ba3ace1..515114d2ca 100644 --- a/awx_collection/test/awx/conftest.py +++ b/awx_collection/test/awx/conftest.py @@ -150,14 +150,14 @@ def run_module(request, collection_import): def mock_load_params(self): self.params = module_params - if getattr(resource_module, 'TowerAWXKitModule', None): - resource_class = resource_module.TowerAWXKitModule - elif getattr(resource_module, 'TowerAPIModule', None): - resource_class = resource_module.TowerAPIModule + if getattr(resource_module, 'ControllerAWXKitModule', None): + resource_class = resource_module.ControllerAWXKitModule + elif getattr(resource_module, 'ControllerAPIModule', None): + resource_class = resource_module.ControllerAPIModule elif getattr(resource_module, 'TowerLegacyModule', None): resource_class = resource_module.TowerLegacyModule else: - raise ("The module has neither a TowerLegacyModule, TowerAWXKitModule or a TowerAPIModule") + raise ("The module has neither a TowerLegacyModule, ControllerAWXKitModule or a ControllerAPIModule") with mock.patch.object(resource_class, '_load_params', new=mock_load_params): # Call the test utility (like a mock server) instead of issuing HTTP requests diff --git a/awx_collection/test/awx/test_module_utils.py b/awx_collection/test/awx/test_module_utils.py index a215db35fc..71c03bd7e6 100644 --- a/awx_collection/test/awx/test_module_utils.py +++ b/awx_collection/test/awx/test_module_utils.py @@ -49,7 +49,7 @@ def mock_awx_ping_response(self, method, url, **kwargs): def test_version_warning(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] with mock.patch.object(sys, 'argv', testargs): @@ -64,7 +64,7 @@ def test_version_warning(collection_import, silence_warning): def test_version_warning_strictness_awx(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] # Compare 1.0.0 to 1.2.3 (major matches) @@ -87,7 +87,7 @@ def test_version_warning_strictness_awx(collection_import, silence_warning): def test_version_warning_strictness_tower(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] # Compare 1.2.0 to 1.2.3 (major/minor matches) @@ -112,7 +112,7 @@ def test_version_warning_strictness_tower(collection_import, silence_warning): def test_type_warning(collection_import, silence_warning): - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule cli_data = {'ANSIBLE_MODULE_ARGS': {}} testargs = ['module_file2.py', json.dumps(cli_data)] with mock.patch.object(sys, 'argv', testargs): @@ -128,7 +128,7 @@ def test_type_warning(collection_import, silence_warning): def test_duplicate_config(collection_import, silence_warning): # imports done here because of PATH issues unique to this test suite - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule data = {'name': 'zigzoom', 'zig': 'zoom', 'tower_username': 'bob', 'tower_config_file': 'my_config'} with mock.patch.object(TowerAPIModule, 'load_config') as mock_load: @@ -152,7 +152,7 @@ def test_no_templated_values(collection_import): Those replacements should happen at build time, so they should not be checked into source. """ - TowerAPIModule = collection_import('plugins.module_utils.tower_api').TowerAPIModule + TowerAPIModule = collection_import('plugins.module_utils.tower_api').ControllerAPIModule assert TowerAPIModule._COLLECTION_VERSION == "0.0.1-devel", ( 'The collection version is templated when the collection is built ' 'and the code should retain the placeholder of "0.0.1-devel".' ) diff --git a/awx_collection/tests/integration/targets/tower_ad_hoc_command/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_ad_hoc_command/tasks/main.yml rename to awx_collection/tests/integration/targets/ad_hoc_command/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_ad_hoc_command_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_ad_hoc_command_cancel/tasks/main.yml rename to awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_ad_hoc_command_wait/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_ad_hoc_command_wait/tasks/main.yml rename to awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_application/tasks/main.yml b/awx_collection/tests/integration/targets/application/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_application/tasks/main.yml rename to awx_collection/tests/integration/targets/application/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_credential/tasks/main.yml b/awx_collection/tests/integration/targets/credential/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_credential/tasks/main.yml rename to awx_collection/tests/integration/targets/credential/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_credential_input_source/tasks/main.yml b/awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_credential_input_source/tasks/main.yml rename to awx_collection/tests/integration/targets/credential_input_source/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_credential_type/tasks/main.yml b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_credential_type/tasks/main.yml rename to awx_collection/tests/integration/targets/credential_type/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_export/aliases b/awx_collection/tests/integration/targets/export/aliases similarity index 100% rename from awx_collection/tests/integration/targets/tower_export/aliases rename to awx_collection/tests/integration/targets/export/aliases diff --git a/awx_collection/tests/integration/targets/tower_export/tasks/main.yml b/awx_collection/tests/integration/targets/export/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_export/tasks/main.yml rename to awx_collection/tests/integration/targets/export/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_group/tasks/main.yml b/awx_collection/tests/integration/targets/group/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_group/tasks/main.yml rename to awx_collection/tests/integration/targets/group/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_host/tasks/main.yml b/awx_collection/tests/integration/targets/host/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_host/tasks/main.yml rename to awx_collection/tests/integration/targets/host/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_import/aliases b/awx_collection/tests/integration/targets/import/aliases similarity index 100% rename from awx_collection/tests/integration/targets/tower_import/aliases rename to awx_collection/tests/integration/targets/import/aliases diff --git a/awx_collection/tests/integration/targets/tower_import/tasks/main.yml b/awx_collection/tests/integration/targets/import/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_import/tasks/main.yml rename to awx_collection/tests/integration/targets/import/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_instance_group/tasks/main.yml b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_instance_group/tasks/main.yml rename to awx_collection/tests/integration/targets/instance_group/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_inventory/tasks/main.yml b/awx_collection/tests/integration/targets/inventory/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_inventory/tasks/main.yml rename to awx_collection/tests/integration/targets/inventory/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_inventory_source/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_inventory_source/tasks/main.yml rename to awx_collection/tests/integration/targets/inventory_source/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml rename to awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/job_cancel/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_cancel/tasks/main.yml rename to awx_collection/tests/integration/targets/job_cancel/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_launch/tasks/main.yml b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_launch/tasks/main.yml rename to awx_collection/tests/integration/targets/job_launch/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_list/tasks/main.yml b/awx_collection/tests/integration/targets/job_list/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_list/tasks/main.yml rename to awx_collection/tests/integration/targets/job_list/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/job_template/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_template/tasks/main.yml rename to awx_collection/tests/integration/targets/job_template/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_job_wait/tasks/main.yml b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_job_wait/tasks/main.yml rename to awx_collection/tests/integration/targets/job_wait/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_label/tasks/main.yml b/awx_collection/tests/integration/targets/label/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_label/tasks/main.yml rename to awx_collection/tests/integration/targets/label/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_lookup_api_plugin/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_lookup_api_plugin/tasks/main.yml rename to awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_notification_template/tasks/main.yml b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_notification_template/tasks/main.yml rename to awx_collection/tests/integration/targets/notification_template/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_organization/tasks/main.yml b/awx_collection/tests/integration/targets/organization/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_organization/tasks/main.yml rename to awx_collection/tests/integration/targets/organization/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_project/tasks/main.yml b/awx_collection/tests/integration/targets/project/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project/tasks/main.yml rename to awx_collection/tests/integration/targets/project/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_project_manual/tasks/create_project_dir.yml b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project_manual/tasks/create_project_dir.yml rename to awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml diff --git a/awx_collection/tests/integration/targets/tower_project_manual/tasks/main.yml b/awx_collection/tests/integration/targets/project_manual/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project_manual/tasks/main.yml rename to awx_collection/tests/integration/targets/project_manual/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_project_update/tasks/main.yml b/awx_collection/tests/integration/targets/project_update/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_project_update/tasks/main.yml rename to awx_collection/tests/integration/targets/project_update/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_role/tasks/main.yml b/awx_collection/tests/integration/targets/role/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_role/tasks/main.yml rename to awx_collection/tests/integration/targets/role/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_schedule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_schedule/tasks/main.yml rename to awx_collection/tests/integration/targets/schedule/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_schedule_rrule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_schedule_rrule/tasks/main.yml rename to awx_collection/tests/integration/targets/schedule_rrule/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_settings/tasks/main.yml b/awx_collection/tests/integration/targets/settings/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_settings/tasks/main.yml rename to awx_collection/tests/integration/targets/settings/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_team/tasks/main.yml b/awx_collection/tests/integration/targets/team/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_team/tasks/main.yml rename to awx_collection/tests/integration/targets/team/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_token/tasks/main.yml rename to awx_collection/tests/integration/targets/token/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_user/tasks/main.yml b/awx_collection/tests/integration/targets/user/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_user/tasks/main.yml rename to awx_collection/tests/integration/targets/user/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_workflow_job_template/tasks/main.yml rename to awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml diff --git a/awx_collection/tests/integration/targets/tower_workflow_launch/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml similarity index 100% rename from awx_collection/tests/integration/targets/tower_workflow_launch/tasks/main.yml rename to awx_collection/tests/integration/targets/workflow_launch/tasks/main.yml diff --git a/awx_collection/tools/roles/generate/templates/tower_module.j2 b/awx_collection/tools/roles/generate/templates/module.j2 similarity index 100% rename from awx_collection/tools/roles/generate/templates/tower_module.j2 rename to awx_collection/tools/roles/generate/templates/module.j2 diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index 84f8174095..1b12854c0d 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -1,15 +1,15 @@ --- -- name: Set the collection version in the tower_api.py file +- name: Set the collection version in the controller_api.py file replace: - path: "{{ collection_path }}/plugins/module_utils/tower_api.py" + path: "{{ collection_path }}/plugins/module_utils/controller_api.py" regexp: '^ _COLLECTION_VERSION = "0.0.1-devel"' replace: ' _COLLECTION_VERSION = "{{ collection_version }}"' when: - "awx_template_version | default(True)" -- name: Set the collection type in the tower_api.py file +- name: Set the collection type in the controller_api.py file replace: - path: "{{ collection_path }}/plugins/module_utils/tower_api.py" + path: "{{ collection_path }}/plugins/module_utils/controller_api.py" regexp: '^ _COLLECTION_TYPE = "awx"' replace: ' _COLLECTION_TYPE = "{{ collection_package }}"' @@ -30,7 +30,7 @@ - name: Change inventory file to support desired namespace and package names replace: - path: "{{ collection_path }}/plugins/inventory/tower.py" + path: "{{ collection_path }}/plugins/inventory/controller.py" regexp: "^ NAME = 'awx.awx.tower' # REPLACE$" replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.tower' # REPLACE"