mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-01 19:54:24 -07:00
Merge 45816e35fd
into 84b5d38c51
This commit is contained in:
commit
31b6d0eb35
2 changed files with 11 additions and 9 deletions
2
changelogs/fragments/10483-sensu-subscription-quotes.yml
Normal file
2
changelogs/fragments/10483-sensu-subscription-quotes.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- sensu_subscription - normalize quotes in the module output (https://github.com/ansible-collections/community.general/pull/10483).
|
|
@ -60,7 +60,7 @@ reasons:
|
|||
description: The reasons why the module changed or did not change something.
|
||||
returned: success
|
||||
type: list
|
||||
sample: ["channel subscription was absent and state is `present'"]
|
||||
sample: ["channel subscription was absent and state is 'present'"]
|
||||
"""
|
||||
|
||||
EXAMPLES = r"""
|
||||
|
@ -89,7 +89,7 @@ def sensu_subscription(module, path, name, state='present', backup=False):
|
|||
except IOError as e:
|
||||
if e.errno == 2: # File not found, non-fatal
|
||||
if state == 'absent':
|
||||
reasons.append('file did not exist and state is `absent\'')
|
||||
reasons.append("file did not exist and state is 'absent'")
|
||||
return changed, reasons
|
||||
config = {}
|
||||
else:
|
||||
|
@ -100,32 +100,32 @@ def sensu_subscription(module, path, name, state='present', backup=False):
|
|||
|
||||
if 'client' not in config:
|
||||
if state == 'absent':
|
||||
reasons.append('`client\' did not exist and state is `absent\'')
|
||||
reasons.append("'client' did not exist and state is 'absent'")
|
||||
return changed, reasons
|
||||
config['client'] = {}
|
||||
changed = True
|
||||
reasons.append('`client\' did not exist')
|
||||
reasons.append("'client' did not exist")
|
||||
|
||||
if 'subscriptions' not in config['client']:
|
||||
if state == 'absent':
|
||||
reasons.append('`client.subscriptions\' did not exist and state is `absent\'')
|
||||
reasons.append("'client.subscriptions' did not exist and state is 'absent'")
|
||||
return changed, reasons
|
||||
config['client']['subscriptions'] = []
|
||||
changed = True
|
||||
reasons.append('`client.subscriptions\' did not exist')
|
||||
reasons.append("'client.subscriptions' did not exist")
|
||||
|
||||
if name not in config['client']['subscriptions']:
|
||||
if state == 'absent':
|
||||
reasons.append('channel subscription was absent')
|
||||
reasons.append("channel subscription was absent")
|
||||
return changed, reasons
|
||||
config['client']['subscriptions'].append(name)
|
||||
changed = True
|
||||
reasons.append('channel subscription was absent and state is `present\'')
|
||||
reasons.append("channel subscription was absent and state is 'present'")
|
||||
else:
|
||||
if state == 'absent':
|
||||
config['client']['subscriptions'].remove(name)
|
||||
changed = True
|
||||
reasons.append('channel subscription was present and state is `absent\'')
|
||||
reasons.append("channel subscription was present and state is 'absent'")
|
||||
|
||||
if changed and not module.check_mode:
|
||||
if backup:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue