Replace manual option check to mutually_exclusive AnsibleModule option

Also return the message "OK" when in check mode to use the same
message as the original success return.
reviewable/pr18780/r1
Willy Barro 9 years ago
parent 7ef07893ad
commit 318983ee53

@ -114,6 +114,9 @@ def main():
title = dict(type='str', required=True),
body = dict(type='str', default=None)
),
mutually_exclusive = (
['channel', 'device'],
),
supports_check_mode=True
)
@ -132,9 +135,6 @@ def main():
target = None
# Checks for channel/device
if device is not None and channel is not None:
module.fail_json(msg="You can't use both device and channel at the same time.")
if device is None and channel is None:
module.fail_json(msg="You need to provide a channel or a device.")
@ -158,7 +158,7 @@ def main():
# If in check mode, exit saying that we succeeded
if module.check_mode:
module.exit_json(changed=False)
module.exit_json(changed=False, msg="OK")
# Send push notification
success, result = target.push_note(title, body)

Loading…
Cancel
Save