Specify types in argument_spec instead of code so that checking type vs default value does not trigger
This commit is contained in:
parent
776d079e6b
commit
47e9a06784
1 changed files with 9 additions and 12 deletions
|
@ -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…
Reference in a new issue