From 318983ee5366ec1846634fc1652c1c43d7fbf8c3 Mon Sep 17 00:00:00 2001 From: Willy Barro Date: Wed, 13 May 2015 19:22:46 -0300 Subject: [PATCH] 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. --- notification/pushbullet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notification/pushbullet.py b/notification/pushbullet.py index ffc2b32232b..5b255b4b549 100644 --- a/notification/pushbullet.py +++ b/notification/pushbullet.py @@ -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)