From caf4b759b9c7d65587eba7752f40e3c5e8556509 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sun, 28 Feb 2016 22:30:39 -0800 Subject: [PATCH] Specify types in argument_spec instead of code so that checking type vs default value does not trigger --- utilities/logic/wait_for.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/utilities/logic/wait_for.py b/utilities/logic/wait_for.py index e30dec11fc6..95e4ec01b5f 100644 --- a/utilities/logic/wait_for.py +++ b/utilities/logic/wait_for.py @@ -332,11 +332,11 @@ def main(): module = AnsibleModule( argument_spec = dict( host=dict(default='127.0.0.1'), - timeout=dict(default=300), - connect_timeout=dict(default=5), - delay=dict(default=0), - port=dict(default=None), - path=dict(default=None), + timeout=dict(default=300, type='int'), + connect_timeout=dict(default=5, type='int'), + delay=dict(default=0, type='int'), + port=dict(default=None, type='int'), + path=dict(default=None, type='path'), search_regex=dict(default=None), state=dict(default='started', choices=['started', 'stopped', 'present', 'absent', 'drained']), exclude_hosts=dict(default=None, type='list') @@ -346,13 +346,10 @@ def main(): params = module.params host = params['host'] - timeout = int(params['timeout']) - connect_timeout = int(params['connect_timeout']) - delay = int(params['delay']) - if params['port']: - port = int(params['port']) - else: - port = None + timeout = params['timeout'] + connect_timeout = params['connect_timeout'] + delay = params['delay'] + port = params['port'] state = params['state'] path = params['path'] search_regex = params['search_regex']