From f06485feca58bfad634d71e1ea2cb96bf0607a51 Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Fri, 4 Jun 2021 13:03:59 -0400 Subject: [PATCH] fqcn redirects, and raise from sanity test fix --- awx_collection/meta/runtime.yml | 82 +++++++++++++++++++ .../plugins/lookup/schedule_rrule.py | 12 +-- .../roles/template_galaxy/tasks/main.yml | 4 +- 3 files changed, 90 insertions(+), 8 deletions(-) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 2fad1211f5..430d7dad74 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -38,6 +38,7 @@ plugin_routing: tower_schedule_rrule: redirect: awx.awx.schedule_rrule modules: + # if playbook does not specify a FQCN tower_ad_hoc_command_cancel: redirect: awx.awx.ad_hoc_command_cancel tower_ad_hoc_command_wait: @@ -118,3 +119,84 @@ plugin_routing: redirect: awx.awx.workflow_launch tower_workflow_node_wait: redirect: awx.awx.workflow_node_wait + # if playbook specifies a FQCN + awx.awx.tower_ad_hoc_command_cancel: + redirect: awx.awx.ad_hoc_command_cancel + awx.awx.tower_ad_hoc_command_wait: + redirect: awx.awx.ad_hoc_command_wait + awx.awx.tower_ad_hoc_command: + redirect: awx.awx.ad_hoc_command + awx.awx.tower_application: + redirect: awx.awx.application + awx.awx.tower_meta: + redirect: awx.awx.controller_meta + awx.awx.tower_credential_input_source: + redirect: awx.awx.credential_input_source + awx.awx.tower_credential_type: + redirect: awx.awx.credential_type + awx.awx.tower_credential: + redirect: awx.awx.credential + awx.awx.tower_execution_environment: + redirect: awx.awx.execution_environment + awx.awx.tower_export: + redirect: awx.awx.export + awx.awx.tower_group: + redirect: awx.awx.group + awx.awx.tower_host: + redirect: awx.awx.host + awx.awx.tower_import: + redirect: awx.awx.import + awx.awx.tower_instance_group: + redirect: awx.awx.instance_group + awx.awx.tower_inventory_source_update: + redirect: awx.awx.inventory_source_update + awx.awx.tower_inventory_source: + redirect: awx.awx.inventory_source + awx.awx.tower_inventory: + redirect: awx.awx.inventory + awx.awx.tower_job_cancel: + redirect: awx.awx.job_cancel + awx.awx.tower_job_launch: + redirect: awx.awx.job_launch + awx.awx.tower_job_list: + redirect: awx.awx.job_list + awx.awx.tower_job_template: + redirect: awx.awx.job_template + awx.awx.tower_job_wait: + redirect: awx.awx.job_wait + awx.awx.tower_label: + redirect: awx.awx.label + awx.awx.tower_license: + redirect: awx.awx.license + awx.awx.tower_notification_template: + redirect: awx.awx.notification_template + awx.awx.tower_notification: + redirect: awx.awx.notification_template + awx.awx.tower_organization: + redirect: awx.awx.organization + awx.awx.tower_project_update: + redirect: awx.awx.project_update + awx.awx.tower_project: + redirect: awx.awx.project + awx.awx.tower_role: + redirect: awx.awx.role + awx.awx.tower_schedule: + redirect: awx.awx.schedule + awx.awx.tower_settings: + redirect: awx.awx.settings + awx.awx.tower_team: + redirect: awx.awx.team + awx.awx.tower_token: + redirect: awx.awx.token + awx.awx.tower_user: + redirect: awx.awx.user + awx.awx.tower_workflow_approval: + redirect: awx.awx.workflow_approval + awx.awx.tower_workflow_job_template_node: + redirect: awx.awx.workflow_job_template_node + awx.awx.tower_workflow_job_template: + redirect: awx.awx.workflow_job_template + awx.awx.tower_workflow_launch: + redirect: awx.awx.workflow_launch + awx.awx.tower_workflow_node_wait: + redirect: awx.awx.workflow_node_wait diff --git a/awx_collection/plugins/lookup/schedule_rrule.py b/awx_collection/plugins/lookup/schedule_rrule.py index 964a1e893a..27f0491e61 100644 --- a/awx_collection/plugins/lookup/schedule_rrule.py +++ b/awx_collection/plugins/lookup/schedule_rrule.py @@ -184,8 +184,8 @@ class LookupModule(LookupBase): else: try: rrule_kwargs['until'] = LookupModule.parse_date_time(end_on) - except Exception: - raise AnsibleError('Parameter end_on must either be an integer or in the format YYYY-MM-DD [HH:MM:SS]') + except Exception as e: + raise AnsibleError('Parameter end_on must either be an integer or in the format YYYY-MM-DD [HH:MM:SS]') from e # A week-based frequency can also take the on_days parameter if frequency == 'week' and 'on_days' in kwargs: @@ -208,16 +208,16 @@ class LookupModule(LookupBase): my_month_day = int(kwargs['month_day_number']) if my_month_day < 1 or my_month_day > 31: raise Exception() - except Exception: - raise AnsibleError('month_day_number must be between 1 and 31') + except Exception as e: + raise AnsibleError('month_day_number must be between 1 and 31') from e rrule_kwargs['bymonthday'] = my_month_day if 'on_the' in kwargs: try: (occurance, weekday) = kwargs['on_the'].split(' ') - except Exception: - raise AnsibleError('on_the parameter must be two words separated by a space') + except Exception as e: + raise AnsibleError('on_the parameter must be two words separated by a space') from e if weekday not in LookupModule.weekdays: raise AnsibleError('Weekday portion of on_the parameter is not valid') diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index b53d339771..aaa21a023f 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -37,8 +37,8 @@ - name: Change runtime.yml redirect destinations replace: path: "{{ collection_path }}/meta/runtime.yml" - regexp: "redirect: awx.awx." - replace: "redirect: {{ collection_namespace }}.{{ collection_package }}." + regexp: "awx.awx." + replace: "{{ collection_namespace }}.{{ collection_package }}." - name: get list of test files find: