From 0e8c7b1c0356b275df32903b317ae91998420a25 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 28 Mar 2014 11:41:35 -0400 Subject: [PATCH] Scrub choices=BOOLEANS from remaining core module references. Correct form in argument_spec is type='dict'. --- library/cloud/ec2_elb | 7 +++---- library/cloud/ec2_elb_lb | 6 ++---- library/cloud/ec2_snapshot | 2 +- library/cloud/elasticache | 4 ++-- library/cloud/gce_pd | 5 ++--- library/system/authorized_key | 2 +- library/system/sysctl | 4 ++-- library/system/ufw | 2 +- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/library/cloud/ec2_elb b/library/cloud/ec2_elb index c7a4e0d3b3..4fc6910691 100644 --- a/library/cloud/ec2_elb +++ b/library/cloud/ec2_elb @@ -313,12 +313,11 @@ class ElbManager: def main(): argument_spec = ec2_argument_spec() argument_spec.update(dict( - state={'required': True, - 'choices': ['present', 'absent']}, + state={'required': True, 'type' : 'bool'}, instance_id={'required': True}, ec2_elbs={'default': None, 'required': False, 'type':'list'}, - enable_availability_zone={'default': True, 'required': False, 'choices': BOOLEANS, 'type': 'bool'}, - wait={'required': False, 'choices': BOOLEANS, 'default': True, 'type': 'bool'}, + enable_availability_zone={'default': True, 'required': False, 'type': 'bool'}, + wait={'required': False, 'default': True, 'type': 'bool'}, wait_timeout={'requred': False, 'default': 0, 'type': 'int'} ) ) diff --git a/library/cloud/ec2_elb_lb b/library/cloud/ec2_elb_lb index ca3adc3193..0737b1a087 100644 --- a/library/cloud/ec2_elb_lb +++ b/library/cloud/ec2_elb_lb @@ -467,11 +467,9 @@ def main(): state={'required': True, 'choices': ['present', 'absent']}, name={'required': True}, listeners={'default': None, 'required': False, 'type': 'list'}, - purge_listeners={'default': True, 'required': False, - 'choices': BOOLEANS, 'type': 'bool'}, + purge_listeners={'default': True, 'required': False, 'type': 'bool'}, zones={'default': None, 'required': False, 'type': 'list'}, - purge_zones={'default': False, 'required': False, - 'choices': BOOLEANS, 'type': 'bool'}, + purge_zones={'default': False, 'required': False, 'type': 'bool'}, security_group_ids={'default': None, 'required': False, 'type': 'list'}, health_check={'default': None, 'required': False, 'type': 'dict'}, ) diff --git a/library/cloud/ec2_snapshot b/library/cloud/ec2_snapshot index 0b499e4776..8673525dfe 100644 --- a/library/cloud/ec2_snapshot +++ b/library/cloud/ec2_snapshot @@ -124,7 +124,7 @@ def main(): ec2_url = dict(), ec2_secret_key = dict(aliases=['aws_secret_key', 'secret_key'], no_log=True), ec2_access_key = dict(aliases=['aws_access_key', 'access_key']), - wait = dict(choices=BOOLEANS, default='true'), + wait = dict(type='bool', default='true'), wait_timeout = dict(type='number', default=0), snapshot_tags = dict(type='dict', default=dict()), ) diff --git a/library/cloud/elasticache b/library/cloud/elasticache index c506b4719c..54bf734d20 100644 --- a/library/cloud/elasticache +++ b/library/cloud/elasticache @@ -489,8 +489,8 @@ def main(): security_group_ids={'required': False, 'default': [], 'type': 'list'}, zone={'required': False, 'default': None}, - wait={'required': False, 'choices': BOOLEANS, 'default': True}, - hard_modify={'required': False, 'choices': BOOLEANS, 'default': False} + wait={'required': False, 'type' : 'bool', 'default': True}, + hard_modify={'required': False, 'type': 'bool', 'default': False} ) ) diff --git a/library/cloud/gce_pd b/library/cloud/gce_pd index a8e631a552..04083aa89e 100644 --- a/library/cloud/gce_pd +++ b/library/cloud/gce_pd @@ -127,10 +127,9 @@ except ImportError: def main(): module = AnsibleModule( argument_spec = dict( - detach_only = dict(choice=BOOLEANS), + detach_only = dict(type='bool'), instance_name = dict(), - mode = dict(default='READ_ONLY', - choices=['READ_WRITE', 'READ_ONLY']), + mode = dict(default='READ_ONLY', choices=['READ_WRITE', 'READ_ONLY']), name = dict(required=True), size_gb = dict(default=10), state = dict(default='present'), diff --git a/library/system/authorized_key b/library/system/authorized_key index 1a7c8b97b0..ac81c39d89 100644 --- a/library/system/authorized_key +++ b/library/system/authorized_key @@ -165,7 +165,7 @@ def keyfile(module, user, write=False, path=None, manage_dir=True): uid = user_entry.pw_uid gid = user_entry.pw_gid - if manage_dir in BOOLEANS_TRUE: + if manage_dir: if not os.path.exists(sshdir): os.mkdir(sshdir, 0700) if module.selinux_enabled(): diff --git a/library/system/sysctl b/library/system/sysctl index ab1da5e095..fd6960f222 100644 --- a/library/system/sysctl +++ b/library/system/sysctl @@ -185,9 +185,9 @@ class SysctlModule(object): def _parse_value(self, value): if value is None: return '' - elif value.lower() in BOOLEANS_TRUE: + elif value.lower(): return '1' - elif value.lower() in BOOLEANS_FALSE: + elif not value.lower(): return '0' else: return value.strip() diff --git a/library/system/ufw b/library/system/ufw index 07f51d853b..73dc9e8974 100644 --- a/library/system/ufw +++ b/library/system/ufw @@ -165,7 +165,7 @@ def main(): default = dict(default=None, aliases=['policy'], choices=['allow', 'deny', 'reject']), logging = dict(default=None, choises=['on', 'off', 'low', 'medium', 'high', 'full']), direction = dict(default=None, choises=['in', 'incoming', 'out', 'outgoing']), - delete = dict(default=False, choices=BOOLEANS), + delete = dict(default=False, type='bool'), insert = dict(default=None), rule = dict(default=None, choices=['allow', 'deny', 'reject', 'limit']), interface = dict(default=None, aliases=['if']),