Specify types in argument_spec instead of code so that checking type vs default value does not trigger

reviewable/pr18780/r1
Toshio Kuratomi 9 years ago
parent edf3aa336f
commit caf4b759b9

@ -332,11 +332,11 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec = dict( argument_spec = dict(
host=dict(default='127.0.0.1'), host=dict(default='127.0.0.1'),
timeout=dict(default=300), timeout=dict(default=300, type='int'),
connect_timeout=dict(default=5), connect_timeout=dict(default=5, type='int'),
delay=dict(default=0), delay=dict(default=0, type='int'),
port=dict(default=None), port=dict(default=None, type='int'),
path=dict(default=None), path=dict(default=None, type='path'),
search_regex=dict(default=None), search_regex=dict(default=None),
state=dict(default='started', choices=['started', 'stopped', 'present', 'absent', 'drained']), state=dict(default='started', choices=['started', 'stopped', 'present', 'absent', 'drained']),
exclude_hosts=dict(default=None, type='list') exclude_hosts=dict(default=None, type='list')
@ -346,13 +346,10 @@ def main():
params = module.params params = module.params
host = params['host'] host = params['host']
timeout = int(params['timeout']) timeout = params['timeout']
connect_timeout = int(params['connect_timeout']) connect_timeout = params['connect_timeout']
delay = int(params['delay']) delay = params['delay']
if params['port']: port = params['port']
port = int(params['port'])
else:
port = None
state = params['state'] state = params['state']
path = params['path'] path = params['path']
search_regex = params['search_regex'] search_regex = params['search_regex']

Loading…
Cancel
Save