Remove HipChat notification type

This commit is contained in:
beeankha
2020-05-19 09:13:21 -04:00
parent bfdd136a46
commit bc4d789da0
8 changed files with 55 additions and 140 deletions

View File

@@ -81,6 +81,7 @@ The following notes are changes that may require changes to playbooks:
- `tower_job_template` no longer supports the deprecated `extra_vars_path` parameter, please use `extra_vars` with the lookup plugin to replace this functionality.
- The `notification_configuration` parameter of `tower_notification` has changed from a string to a dict. Please use the `lookup` plugin to read an existing file into a dict.
- `tower_credential` no longer supports passing a file name to ssh_key_data.
- The HipChat notification type has been removed and can no longer be created using the `tower_notification` module.
## Running Unit Tests

View File

@@ -46,7 +46,6 @@ options:
choices:
- 'email'
- 'grafana'
- 'hipchat'
- 'irc'
- 'mattermost'
- 'pagerduty'
@@ -159,7 +158,7 @@ options:
api_url:
description:
- The HipChat API URL.
- This parameter has been deprecated, please use 'notification_configuration' instead.
- The HipChat notification type has been deprecated.
type: str
color:
description:
@@ -170,7 +169,7 @@ options:
rooms:
description:
- HipChat rooms to send the notification to.
- This parameter has been deprecated, please use 'notification_configuration' instead.
- The HipChat notification type has been deprecated.
type: list
elements: str
notify:
@@ -293,21 +292,6 @@ EXAMPLES = '''
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add HipChat notification
tower_notification:
name: hipchat notification
notification_type: hipchat
notification_configuration:
token: a_token
message_from: user1
api_url: https://hipchat.example.com
color: red
rooms:
- room-A
notify: yes
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add IRC notification
tower_notification:
name: irc notification
@@ -336,13 +320,17 @@ RETURN = ''' # '''
from ..module_utils.tower_api import TowerModule
HIPCHAT_PARAMS = (
'api_url', 'rooms',
)
OLD_INPUT_NAMES = (
'username', 'sender', 'recipients', 'use_tls',
'host', 'use_ssl', 'password', 'port',
'channels', 'token', 'account_token', 'from_number',
'to_numbers', 'account_sid', 'subdomain', 'service_key',
'client_name', 'message_from', 'api_url', 'color',
'rooms', 'notify', 'url', 'headers', 'server',
'client_name', 'message_from', 'color',
'notify', 'url', 'headers', 'server',
'nickname', 'targets',
)
@@ -355,7 +343,7 @@ def main():
description=dict(),
organization=dict(),
notification_type=dict(choices=[
'email', 'grafana', 'hipchat', 'irc', 'mattermost',
'email', 'grafana', 'irc', 'mattermost',
'pagerduty', 'rocketchat', 'slack', 'twilio', 'webhook'
]),
notification_configuration=dict(type='dict'),
@@ -395,7 +383,7 @@ def main():
# Extract our parameters
name = module.params.get('name')
new_name = module.params.get("new_name")
new_name = module.params.get('new_name')
description = module.params.get('description')
organization = module.params.get('organization')
notification_type = module.params.get('notification_type')
@@ -403,10 +391,16 @@ def main():
messages = module.params.get('messages')
state = module.params.get('state')
# Deprecation warnings
# Deprecation/removal warnings for HipChat notification type
for hipchat_params in HIPCHAT_PARAMS:
if module.params.get(hipchat_params) is not None:
module.deprecate(msg='{0} parameter has been deprecated; the HipChat notification type can no longer be generated'.format(hipchat_params),
version="4.0")
# Deprecation warnings for all other params
for legacy_input in OLD_INPUT_NAMES:
if module.params.get(legacy_input) is not None:
module.deprecate(msg='{0} parameter has been deprecated, please use notification_configuration instead.'.format(legacy_input), version="3.6")
module.deprecate(msg='{0} parameter has been deprecated, please use notification_configuration instead'.format(legacy_input), version="3.6")
# Attempt to look up the related items the user specified (these will fail the module if not found)
organization_id = None

View File

@@ -6,7 +6,6 @@
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') }}"
hipchat_not: "AWX-Collection-tests-tower_notification-hipchat-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') }}"
- name: Test deprecation warnings
@@ -212,36 +211,6 @@
that:
- result is changed
- name: Add HipChat notification
tower_notification:
name: "{{ hipchat_not }}"
organization: Default
notification_type: hipchat
token: a_token
message_from: user1
api_url: https://hipchat.example.com
color: red
rooms:
- room-A
notify: true
state: present
register: result
- assert:
that:
- result is changed
- name: Delete HipChat notification
tower_notification:
name: "{{ hipchat_not }}"
organization: Default
state: absent
register: result
- assert:
that:
- result is changed
- name: Add IRC notification
tower_notification:
name: "{{ irc_not }}"