1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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'), region_id = dict(type='int'),
ssh_key_ids = dict(default=''), ssh_key_ids = dict(default=''),
id = dict(aliases=['droplet_id'], type='int'), id = dict(aliases=['droplet_id'], type='int'),
unique_name = dict(type='bool', choices=BOOLEANS, default='no'), unique_name = dict(type='bool', default='no'),
wait = dict(type='bool', choices=BOOLEANS, default='yes'), wait = dict(type='bool', default=True),
wait_timeout = dict(default=300, type='int'), wait_timeout = dict(default=300, type='int'),
ssh_pub_key = dict(type='str'), ssh_pub_key = dict(type='str'),
), ),

View file

@ -444,7 +444,7 @@ def main():
password = dict(type='str'), password = dict(type='str'),
ssh_pub_key = dict(type='str'), ssh_pub_key = dict(type='str'),
swap = dict(type='int', default=512), 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), wait_timeout = dict(default=300),
) )
) )

View file

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

View file

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

View file

@ -155,7 +155,7 @@ def main():
value = dict(required=False), value = dict(required=False),
aws_secret_key = dict(aliases=['ec2_secret_key', 'secret_key'], no_log=True, 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), 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']), 'A', 'AAAA', 'CNAME', 'HTTPRED', 'MX', 'NS', 'PTR', 'SRV', 'TXT']),
record_value=dict(required=False), record_value=dict(required=False),
record_ttl=dict(required=False, default=1800, type='int'), 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=( required_together=(
['record_value', 'record_ttl', 'record_type'] ['record_value', 'record_ttl', 'record_type']

View file

@ -144,7 +144,7 @@ def main():
payload = dict(required = True), payload = dict(required = True),
client_id = dict(default = None), client_id = dict(default = None),
qos = dict(default="0", choices=["0", "1", "2"]), 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), username = dict(default = None),
password = dict(default = None), password = dict(default = None),
), ),

View file

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

View file

@ -177,7 +177,7 @@ def main():
argument_spec = dict( argument_spec = dict(
name = dict(required=True, aliases=['pkg']), name = dict(required=True, aliases=['pkg']),
state = dict(required=False, default='present', choices=['absent', 'installed', 'latest', 'present', 'removed']), 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 supports_check_mode = False
) )

View file

@ -341,7 +341,7 @@ def main():
state=dict(default='present', choices=['present', 'absent'], type='str'), state=dict(default='present', choices=['present', 'absent'], type='str'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
gid=dict(default=None, 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 supports_check_mode=True
) )

View file

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

View file

@ -1372,7 +1372,7 @@ def main():
# following options are specific to usermod # following options are specific to usermod
append=dict(default='no', type='bool'), append=dict(default='no', type='bool'),
# following are specific to ssh key generation # 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_bits=dict(default=ssh_defaults['bits'], type='str'),
ssh_key_type=dict(default=ssh_defaults['type'], type='str'), ssh_key_type=dict(default=ssh_defaults['type'], type='str'),
ssh_key_file=dict(default=None, type='str'), ssh_key_file=dict(default=None, type='str'),

View file

@ -178,7 +178,7 @@ def main():
password=dict(required=False, default=None), password=dict(required=False, default=None),
crypt_scheme=dict(required=False, default=None), crypt_scheme=dict(required=False, default=None),
state=dict(required=False, default="present"), 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, module = AnsibleModule(argument_spec=arg_spec,