changed 'deleted' to 'absent'

This commit is contained in:
Bruce Pennypacker 2015-06-14 20:20:36 +00:00 committed by Matt Clay
parent 07aa5bc09a
commit 2aa148a746

View file

@ -20,7 +20,7 @@ options:
- Create a maintenance window or get a list of ongoing windows. - Create a maintenance window or get a list of ongoing windows.
required: true required: true
default: null default: null
choices: [ "running", "started", "ongoing", "deleted" ] choices: [ "running", "started", "ongoing", "absent" ]
aliases: [] aliases: []
name: name:
description: description:
@ -136,7 +136,7 @@ EXAMPLES='''
- pagerduty: name=companyabc - pagerduty: name=companyabc
user=example@example.com user=example@example.com
passwd=password123 passwd=password123
state=deleted state=absent
service={{ pd_window.result.maintenance_window.id }} service={{ pd_window.result.maintenance_window.id }}
''' '''
@ -197,7 +197,7 @@ def create(module, name, user, passwd, token, requester_id, service, hours, minu
return False, json_out, True return False, json_out, True
def delete(module, name, user, passwd, token, requester_id, service): def absent(module, name, user, passwd, token, requester_id, service):
url = "https://" + name + ".pagerduty.com/api/v1/maintenance_windows/" + service[0] url = "https://" + name + ".pagerduty.com/api/v1/maintenance_windows/" + service[0]
headers = { headers = {
'Authorization': auth_header(user, passwd, token), 'Authorization': auth_header(user, passwd, token),
@ -228,7 +228,7 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
state=dict(required=True, choices=['running', 'started', 'ongoing', 'deleted']), state=dict(required=True, choices=['running', 'started', 'ongoing', 'absent']),
name=dict(required=True), name=dict(required=True),
user=dict(required=False), user=dict(required=False),
passwd=dict(required=False), passwd=dict(required=False),
@ -267,8 +267,8 @@ def main():
if state == "ongoing": if state == "ongoing":
(rc, out, changed) = ongoing(module, name, user, passwd, token) (rc, out, changed) = ongoing(module, name, user, passwd, token)
if state == "deleted": if state == "absent":
(rc, out, changed) = delete(module, name, user, passwd, token, requester_id, service) (rc, out, changed) = absent(module, name, user, passwd, token, requester_id, service)
if rc != 0: if rc != 0:
module.fail_json(msg="failed", result=out) module.fail_json(msg="failed", result=out)