Remove examples of module antipattern of setting the choices array for boolean types.

This commit is contained in:
Michael DeHaan 2013-10-11 08:45:13 -04:00
parent a9225d0c7a
commit 119b6d73dd
13 changed files with 13 additions and 16 deletions

View file

@ -373,8 +373,8 @@ def main():
region_id = dict(type='int'),
ssh_key_ids = dict(default=''),
id = dict(aliases=['droplet_id'], type='int'),
unique_name = dict(type='bool', choices=BOOLEANS, default='no'),
wait = dict(type='bool', choices=BOOLEANS, default='yes'),
unique_name = dict(type='bool', default='no'),
wait = dict(type='bool', default=True),
wait_timeout = dict(default=300, type='int'),
ssh_pub_key = dict(type='str'),
),

View file

@ -444,7 +444,7 @@ def main():
password = dict(type='str'),
ssh_pub_key = dict(type='str'),
swap = dict(type='int', default=512),
wait = dict(type='bool', choices=BOOLEANS, default=True),
wait = dict(type='bool', default=True),
wait_timeout = dict(default=300),
)
)

View file

@ -247,7 +247,7 @@ def main():
key_name = dict(aliases = ['keypair']),
files = dict(type='dict', default={}),
region = dict(),
wait = dict(type='bool', choices=BOOLEANS),
wait = dict(type='bool'),
wait_timeout = dict(default=300),
)
)

View file

@ -196,7 +196,7 @@ def main():
type=dict(choices=['primary', 'secondary']),
username=dict(),
virtualenv=dict(),
wait=dict(default=False, choices=BOOLEANS, type='bool'),
wait=dict(default=False, type='bool'),
wait_timeout=dict(default=30, type='int'),
weight=dict(type='int'),
),

View file

@ -155,7 +155,7 @@ def main():
value = dict(required=False),
aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True, required=False),
aws_access_key = dict(aliases=['ec2_access_key', 'access_key'], required=False),
overwrite = dict(required=False, choices=BOOLEANS, type='bool')
overwrite = dict(required=False, type='bool')
)
)

View file

@ -263,8 +263,6 @@ def main():
'A', 'AAAA', 'CNAME', 'HTTPRED', 'MX', 'NS', 'PTR', 'SRV', 'TXT']),
record_value=dict(required=False),
record_ttl=dict(required=False, default=1800, type='int'),
#redirecttype=dict(required=False,default='Hidden Frame Masked',choices=[ 'Hidden Frame Masked', 'Standard 301', 'Standard 302' ]),
#hardlink=dict(requred=False, default=False, type='bool', choices=BOOLEANS)
),
required_together=(
['record_value', 'record_ttl', 'record_type']

View file

@ -144,7 +144,7 @@ def main():
payload = dict(required = True),
client_id = dict(default = None),
qos = dict(default="0", choices=["0", "1", "2"]),
retain = dict(default='no', choices=BOOLEANS, type='bool'),
retain = dict(default=False, type='bool'),
username = dict(default = None),
password = dict(default = None),
),

View file

@ -711,8 +711,7 @@ def main():
disablerepo=dict(),
list=dict(),
conf_file=dict(default=None),
disable_gpg_check=dict(required=False, default="no",
choices=BOOLEANS, type='bool'),
disable_gpg_check=dict(required=False, default="no", type='bool'),
),
required_one_of = [['name','list']],
mutually_exclusive = [['name','list']],

View file

@ -177,7 +177,7 @@ def main():
argument_spec = dict(
name = dict(required=True, aliases=['pkg']),
state = dict(required=False, default='present', choices=['absent', 'installed', 'latest', 'present', 'removed']),
disable_gpg_check = dict(required=False, default='no', choices=BOOLEANS, type='bool'),
disable_gpg_check = dict(required=False, default='no', type='bool'),
),
supports_check_mode = False
)

View file

@ -341,7 +341,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'),
name=dict(required=True, type='str'),
gid=dict(default=None, type='str'),
system=dict(default='no', choices=['yes', 'no'], type='bool'),
system=dict(default=False, type='bool'),
),
supports_check_mode=True
)

View file

@ -1108,7 +1108,7 @@ def main():
state = dict(choices=['running', 'started', 'stopped', 'restarted', 'reloaded']),
sleep = dict(required=False, type='int', default=None),
pattern = dict(required=False, default=None),
enabled = dict(choices=BOOLEANS, type='bool'),
enabled = dict(type='bool'),
runlevel = dict(required=False, default='default'),
arguments = dict(aliases=['args'], default=''),
),

View file

@ -1372,7 +1372,7 @@ def main():
# following options are specific to usermod
append=dict(default='no', type='bool'),
# following are specific to ssh key generation
generate_ssh_key=dict(choices=BOOLEANS, type='bool'),
generate_ssh_key=dict(type='bool'),
ssh_key_bits=dict(default=ssh_defaults['bits'], type='str'),
ssh_key_type=dict(default=ssh_defaults['type'], type='str'),
ssh_key_file=dict(default=None, type='str'),

View file

@ -178,7 +178,7 @@ def main():
password=dict(required=False, default=None),
crypt_scheme=dict(required=False, default=None),
state=dict(required=False, default="present"),
create=dict(type='bool', choices=BOOLEANS, default='yes'),
create=dict(type='bool', default='yes'),
)
module = AnsibleModule(argument_spec=arg_spec,