diff --git a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_alarm.py b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_alarm.py index f4d2a9398a5..f9b97bc8dd1 100644 --- a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_alarm.py +++ b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_alarm.py @@ -105,17 +105,6 @@ except ImportError: def alarm(module, state, label, entity_id, check_id, notification_plan_id, criteria, disabled, metadata): - # Verify the presence of required attributes. - - required_attrs = { - "label": label, "entity_id": entity_id, "check_id": check_id, - "notification_plan_id": notification_plan_id - } - - for (key, value) in required_attrs.iteritems(): - if not value: - module.fail_json(msg=('%s is required for rax_mon_alarm' % key)) - if len(label) < 1 or len(label) > 255: module.fail_json(msg='label must be between 1 and 255 characters long') @@ -173,12 +162,10 @@ def alarm(module, state, label, entity_id, check_id, notification_plan_id, crite criteria=criteria, disabled=disabled, label=label, metadata=metadata) changed = True - elif state == 'absent': + else: for a in existing: a.delete() changed = True - else: - module.fail_json(msg='state must be either present or absent.') if alarm: alarm_dict = { diff --git a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_check.py b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_check.py index 27798e6cd5a..101efd3c858 100644 --- a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_check.py +++ b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_check.py @@ -141,16 +141,6 @@ def cloud_check(module, state, entity_id, label, check_type, monitoring_zones_poll, target_hostname, target_alias, details, disabled, metadata, period, timeout): - # Verify the presence of required attributes. - - required_attrs = { - "entity_id": entity_id, "label": label, "check_type": check_type - } - - for (key, value) in required_attrs.iteritems(): - if not value: - module.fail_json(msg=('%s is required for rax_mon_check' % key)) - # Coerce attributes. if monitoring_zones_poll and not isinstance(monitoring_zones_poll, list): diff --git a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_entity.py b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_entity.py index b1bd13c61ad..5f82ff9c524 100644 --- a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_entity.py +++ b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_entity.py @@ -83,8 +83,6 @@ except ImportError: def cloud_monitoring(module, state, label, agent_id, named_ip_addresses, metadata): - if not label: - module.fail_json(msg='label is required for rax_mon_entity') if len(label) < 1 or len(label) > 255: module.fail_json(msg='label must be between 1 and 255 characters long') @@ -139,13 +137,11 @@ def cloud_monitoring(module, state, label, agent_id, named_ip_addresses, ip_addresses=named_ip_addresses, metadata=metadata) changed = True - elif state == 'absent': + else: # Delete the existing Entities. for e in existing: e.delete() changed = True - else: - module.fail_json(msg='state must be present or absent') if entity: entity_dict = { diff --git a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification.py b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification.py index 6962b14b3e6..8a21b088c5e 100644 --- a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification.py +++ b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification.py @@ -76,18 +76,9 @@ except ImportError: def notification(module, state, label, notification_type, details): - if not label: - module.fail_json(msg='label is required for rax_mon_notification') - if len(label) < 1 or len(label) > 255: module.fail_json(msg='label must be between 1 and 255 characters long') - if not notification_type: - module.fail_json(msg='you must provide a notification_type') - - if not details: - module.fail_json(msg='notification details are required') - changed = False notification = None @@ -132,12 +123,10 @@ def notification(module, state, label, notification_type, details): notification = cm.create_notification(notification_type, label=label, details=details) changed = True - elif state == 'absent': + else: for n in existing: n.delete() changed = True - else: - module.fail_json(msg='state must be either "present" or "absent"') if notification: notification_dict = { diff --git a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification_plan.py b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification_plan.py index 1bb5052c8f2..05b89b2cfb3 100644 --- a/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification_plan.py +++ b/lib/ansible/modules/extras/cloud/rackspace/rax_mon_notification_plan.py @@ -80,9 +80,6 @@ except ImportError: def notification_plan(module, state, label, critical_state, warning_state, ok_state): - if not label: - module.fail_json(msg='label is required for rax_mon_notification_plan') - if len(label) < 1 or len(label) > 255: module.fail_json(msg='label must be between 1 and 255 characters long') @@ -128,12 +125,10 @@ def notification_plan(module, state, label, critical_state, warning_state, ok_st warning_state=warning_state, ok_state=ok_state) changed = True - elif state == 'absent': + else: for np in existing: np.delete() changed = True - else: - module.fail_json(msg='state must be either "present" or "absent"') if notification_plan: notification_plan_dict = {