From b1ffbf1e395937e8048cf67b3cdc8de25a5ff64d Mon Sep 17 00:00:00 2001 From: John Westcott IV Date: Mon, 24 Aug 2020 13:59:05 -0400 Subject: [PATCH] Change module from tower_notification to tower_notification_template --- awx_collection/meta/runtime.yml | 2 + ...tion.py => tower_notification_template.py} | 16 ++++---- awx_collection/test/awx/test_completeness.py | 6 +++ .../tasks/main.yml | 38 +++++++++---------- 4 files changed, 35 insertions(+), 27 deletions(-) rename awx_collection/plugins/modules/{tower_notification.py => tower_notification_template.py} (98%) rename awx_collection/tests/integration/targets/{tower_notification => tower_notification_template}/tasks/main.yml (77%) diff --git a/awx_collection/meta/runtime.yml b/awx_collection/meta/runtime.yml index 3980ccc14c..d8c2535871 100644 --- a/awx_collection/meta/runtime.yml +++ b/awx_collection/meta/runtime.yml @@ -13,3 +13,5 @@ plugin_routing: deprecation: removal_date: TBD warning_text: see plugin documentation for details + tower_notifitcation: + redirect: tower_notification_template diff --git a/awx_collection/plugins/modules/tower_notification.py b/awx_collection/plugins/modules/tower_notification_template.py similarity index 98% rename from awx_collection/plugins/modules/tower_notification.py rename to awx_collection/plugins/modules/tower_notification_template.py index 12dd28ef31..ec25038e34 100644 --- a/awx_collection/plugins/modules/tower_notification.py +++ b/awx_collection/plugins/modules/tower_notification_template.py @@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- -module: tower_notification +module: tower_notification_template author: "Samuel Carpentier (@samcarpentier)" short_description: create, update, or destroy Ansible Tower notification. description: @@ -203,7 +203,7 @@ extends_documentation_fragment: awx.awx.auth EXAMPLES = ''' - name: Add Slack notification with custom messages - tower_notification: + tower_notification_template: name: slack notification organization: Default notification_type: slack @@ -222,7 +222,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add webhook notification - tower_notification: + tower_notification_template: name: webhook notification notification_type: webhook notification_configuration: @@ -233,7 +233,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add email notification - tower_notification: + tower_notification_template: name: email notification notification_type: email notification_configuration: @@ -250,7 +250,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add twilio notification - tower_notification: + tower_notification_template: name: twilio notification notification_type: twilio notification_configuration: @@ -263,7 +263,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add PagerDuty notification - tower_notification: + tower_notification_template: name: pagerduty notification notification_type: pagerduty notification_configuration: @@ -275,7 +275,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Add IRC notification - tower_notification: + tower_notification_template: name: irc notification notification_type: irc notification_configuration: @@ -290,7 +290,7 @@ EXAMPLES = ''' tower_config_file: "~/tower_cli.cfg" - name: Delete notification - tower_notification: + tower_notification_template: name: old notification state: absent tower_config_file: "~/tower_cli.cfg" diff --git a/awx_collection/test/awx/test_completeness.py b/awx_collection/test/awx/test_completeness.py index de953aac0f..bbdc1a8c1d 100755 --- a/awx_collection/test/awx/test_completeness.py +++ b/awx_collection/test/awx/test_completeness.py @@ -59,6 +59,12 @@ no_api_parameter_ok = { 'tower_workflow_job_template_node': ['always_nodes', 'failure_nodes', 'success_nodes', 'credentials', 'organization'], # Survey is how we handle associations 'tower_workflow_job_template': ['survey'], + # These fields get wrapped into notification_configuration + 'tower_notification_template': [ + 'account_sid', 'account_token', 'channels', 'client_name', 'color', 'from_number', 'headers', 'host', + 'message_from', 'nickname', 'notify', 'password', 'port', 'recipients', 'sender', 'server', + 'service_key', 'subdomain', 'targets', 'to_numbers', 'token', 'url', 'use_ssl', 'use_tls', 'username', + ] } # When this tool was created we were not feature complete. Adding something in here indicates a module diff --git a/awx_collection/tests/integration/targets/tower_notification/tasks/main.yml b/awx_collection/tests/integration/targets/tower_notification_template/tasks/main.yml similarity index 77% rename from awx_collection/tests/integration/targets/tower_notification/tasks/main.yml rename to awx_collection/tests/integration/targets/tower_notification_template/tasks/main.yml index ea3e96b90a..a4d41571cf 100644 --- a/awx_collection/tests/integration/targets/tower_notification/tasks/main.yml +++ b/awx_collection/tests/integration/targets/tower_notification_template/tasks/main.yml @@ -1,14 +1,14 @@ --- - name: Generate names set_fact: - slack_not: "AWX-Collection-tests-tower_notification-slack-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - webhook_not: "AWX-Collection-tests-tower_notification-wehbook-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - email_not: "AWX-Collection-tests-tower_notification-email-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - twillo_not: "AWX-Collection-tests-tower_notification-twillo-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - pd_not: "AWX-Collection-tests-tower_notification-pd-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - irc_not: "AWX-Collection-tests-tower_notification-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + slack_not: "AWX-Collection-tests-tower_notification_template-slack-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + email_not: "AWX-Collection-tests-tower_notification_template-email-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + twillo_not: "AWX-Collection-tests-tower_notification_template-twillo-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + pd_not: "AWX-Collection-tests-tower_notification_template-pd-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + irc_not: "AWX-Collection-tests-tower_notification_template-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" -- name: Test deprecation warnings +- name: Test deprecation warnings with legacy name tower_notification: name: "{{ slack_not }}" organization: Default @@ -54,7 +54,7 @@ - result['deprecations'] | length() == 25 - name: Create Slack notification with custom messages - tower_notification: + tower_notification_template: name: "{{ slack_not }}" organization: Default notification_type: slack @@ -76,7 +76,7 @@ - result is changed - name: Delete Slack notification - tower_notification: + tower_notification_template: name: "{{ slack_not }}" organization: Default state: absent @@ -87,7 +87,7 @@ - result is changed - name: Add webhook notification - tower_notification: + tower_notification_template: name: "{{ webhook_not }}" organization: Default notification_type: webhook @@ -102,7 +102,7 @@ - result is changed - name: Delete webhook notification - tower_notification: + tower_notification_template: name: "{{ webhook_not }}" organization: Default state: absent @@ -113,7 +113,7 @@ - result is changed - name: Add email notification - tower_notification: + tower_notification_template: name: "{{ email_not }}" organization: Default notification_type: email @@ -134,7 +134,7 @@ - result is changed - name: Delete email notification - tower_notification: + tower_notification_template: name: "{{ email_not }}" organization: Default state: absent @@ -145,7 +145,7 @@ - result is changed - name: Add twilio notification - tower_notification: + tower_notification_template: name: "{{ twillo_not }}" organization: Default notification_type: twilio @@ -162,7 +162,7 @@ - result is changed - name: Delete twilio notification - tower_notification: + tower_notification_template: name: "{{ twillo_not }}" organization: Default state: absent @@ -173,7 +173,7 @@ - result is changed - name: Add PagerDuty notification - tower_notification: + tower_notification_template: name: "{{ pd_not }}" organization: Default notification_type: pagerduty @@ -189,7 +189,7 @@ - result is changed - name: Delete PagerDuty notification - tower_notification: + tower_notification_template: name: "{{ pd_not }}" organization: Default state: absent @@ -200,7 +200,7 @@ - result is changed - name: Add IRC notification - tower_notification: + tower_notification_template: name: "{{ irc_not }}" organization: Default notification_type: irc @@ -219,7 +219,7 @@ - result is changed - name: Delete IRC notification - tower_notification: + tower_notification_template: name: "{{ irc_not }}" organization: Default state: absent