mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 04:34: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.
|
description: The reasons why the module changed or did not change something.
|
||||||
returned: success
|
returned: success
|
||||||
type: list
|
type: list
|
||||||
sample: ["channel subscription was absent and state is `present'"]
|
sample: ["channel subscription was absent and state is 'present'"]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
|
@ -89,7 +89,7 @@ def sensu_subscription(module, path, name, state='present', backup=False):
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
if e.errno == 2: # File not found, non-fatal
|
if e.errno == 2: # File not found, non-fatal
|
||||||
if state == 'absent':
|
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
|
return changed, reasons
|
||||||
config = {}
|
config = {}
|
||||||
else:
|
else:
|
||||||
|
@ -100,32 +100,32 @@ def sensu_subscription(module, path, name, state='present', backup=False):
|
||||||
|
|
||||||
if 'client' not in config:
|
if 'client' not in config:
|
||||||
if state == 'absent':
|
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
|
return changed, reasons
|
||||||
config['client'] = {}
|
config['client'] = {}
|
||||||
changed = True
|
changed = True
|
||||||
reasons.append('`client\' did not exist')
|
reasons.append("'client' did not exist")
|
||||||
|
|
||||||
if 'subscriptions' not in config['client']:
|
if 'subscriptions' not in config['client']:
|
||||||
if state == 'absent':
|
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
|
return changed, reasons
|
||||||
config['client']['subscriptions'] = []
|
config['client']['subscriptions'] = []
|
||||||
changed = True
|
changed = True
|
||||||
reasons.append('`client.subscriptions\' did not exist')
|
reasons.append("'client.subscriptions' did not exist")
|
||||||
|
|
||||||
if name not in config['client']['subscriptions']:
|
if name not in config['client']['subscriptions']:
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
reasons.append('channel subscription was absent')
|
reasons.append("channel subscription was absent")
|
||||||
return changed, reasons
|
return changed, reasons
|
||||||
config['client']['subscriptions'].append(name)
|
config['client']['subscriptions'].append(name)
|
||||||
changed = True
|
changed = True
|
||||||
reasons.append('channel subscription was absent and state is `present\'')
|
reasons.append("channel subscription was absent and state is 'present'")
|
||||||
else:
|
else:
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
config['client']['subscriptions'].remove(name)
|
config['client']['subscriptions'].remove(name)
|
||||||
changed = True
|
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 changed and not module.check_mode:
|
||||||
if backup:
|
if backup:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue