Add explicit argument_spec types to avoid misinterpretation and subsequent errors (i.e. getting an int instead of the expected str)

This commit is contained in:
Eike Frost 2016-02-28 19:18:39 +00:00
parent 479f99678b
commit 47466242a3
5 changed files with 27 additions and 27 deletions

View file

@ -150,10 +150,10 @@ class HostGroup(object):
def main():
module = AnsibleModule(
argument_spec=dict(
server_url=dict(required=True, aliases=['url']),
login_user=dict(required=True),
login_password=dict(required=True, no_log=True),
host_groups=dict(required=True, aliases=['host_group']),
server_url=dict(type='str', required=True, aliases=['url']),
login_user=dict(type='str', required=True),
login_password=dict(type='str', required=True, no_log=True),
host_groups=dict(type='list', required=True, aliases=['host_group']),
state=dict(default="present", choices=['present','absent']),
timeout=dict(type='int', default=10)
),

View file

@ -367,18 +367,18 @@ class Host(object):
def main():
module = AnsibleModule(
argument_spec=dict(
server_url=dict(required=True, aliases=['url']),
login_user=dict(required=True),
login_password=dict(required=True, no_log=True),
host_name=dict(required=True),
host_groups=dict(required=False),
link_templates=dict(required=False),
server_url=dict(type='str', required=True, aliases=['url']),
login_user=dict(rtype='str', equired=True),
login_password=dict(type='str', required=True, no_log=True),
host_name=dict(type='str', required=True),
host_groups=dict(type='list', required=False),
link_templates=dict(type='list', required=False),
status=dict(default="enabled", choices=['enabled', 'disabled']),
state=dict(default="present", choices=['present', 'absent']),
timeout=dict(type='int', default=10),
interfaces=dict(required=False),
force=dict(default=True, type='bool'),
proxy=dict(required=False)
interfaces=dict(type='list', required=False),
force=dict(type='bool', default=True),
proxy=dict(type='str', required=False)
),
supports_check_mode=True
)

View file

@ -171,12 +171,12 @@ class HostMacro(object):
def main():
module = AnsibleModule(
argument_spec=dict(
server_url=dict(required=True, aliases=['url']),
login_user=dict(required=True),
login_password=dict(required=True, no_log=True),
host_name=dict(required=True),
macro_name=dict(required=True),
macro_value=dict(required=True),
server_url=dict(type='str', required=True, aliases=['url']),
login_user=dict(type='str', required=True),
login_password=dict(type='str', required=True, no_log=True),
host_name=dict(type='str', required=True),
macro_name=dict(type='str', required=True),
macro_value=dict(type='str', required=True),
state=dict(default="present", choices=['present', 'absent']),
timeout=dict(type='int', default=10)
),

View file

@ -266,14 +266,14 @@ def main():
module = AnsibleModule(
argument_spec=dict(
state=dict(required=False, default='present', choices=['present', 'absent']),
server_url=dict(required=True, default=None, aliases=['url']),
server_url=dict(type='str', required=True, default=None, aliases=['url']),
host_names=dict(type='list', required=False, default=None, aliases=['host_name']),
minutes=dict(type='int', required=False, default=10),
host_groups=dict(type='list', required=False, default=None, aliases=['host_group']),
login_user=dict(required=True),
login_password=dict(required=True, no_log=True),
name=dict(required=True),
desc=dict(required=False, default="Created by Ansible"),
login_user=dict(type='str', required=True),
login_password=dict(type='str', required=True, no_log=True),
name=dict(type='str', required=True),
desc=dict(type='str', required=False, default="Created by Ansible"),
collect_data=dict(type='bool', required=False, default=True),
),
supports_check_mode=True,

View file

@ -315,9 +315,9 @@ class Screen(object):
def main():
module = AnsibleModule(
argument_spec=dict(
server_url=dict(required=True, aliases=['url']),
login_user=dict(required=True),
login_password=dict(required=True, no_log=True),
server_url=dict(type='str', required=True, aliases=['url']),
login_user=dict(type='str', required=True),
login_password=dict(type='str', required=True, no_log=True),
timeout=dict(type='int', default=10),
screens=dict(type='list', required=True)
),