Pep8 fixes for web_infra/ansible_tower (#24479)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-05-11 21:56:36 +05:30 committed by Matt Martz
parent fc3cc73b73
commit 728d3e6c84
16 changed files with 238 additions and 253 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -213,38 +213,38 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
user = dict(),
team = dict(),
kind = dict(required=True,
argument_spec=dict(
name=dict(required=True),
user=dict(),
team=dict(),
kind=dict(required=True,
choices=["ssh", "net", "scm", "aws", "rax", "vmware", "satellite6",
"cloudforms", "gce", "azure", "azure_rm", "openstack"]),
host = dict(),
username = dict(),
password = dict(no_log=True),
ssh_key_data = dict(no_log=True),
ssh_key_unlock = dict(no_log=True),
authorize = dict(type='bool', default=False),
authorize_password = dict(no_log=True),
client = dict(),
secret = dict(),
tenant = dict(),
subscription = dict(),
domain = dict(),
become_method = dict(),
become_username = dict(),
become_password = dict(no_log=True),
vault_password = dict(no_log=True),
description = dict(),
organization = dict(required=True),
project = dict(),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
host=dict(),
username=dict(),
password=dict(no_log=True),
ssh_key_data=dict(no_log=True),
ssh_key_unlock=dict(no_log=True),
authorize=dict(type='bool', default=False),
authorize_password=dict(no_log=True),
client=dict(),
secret=dict(),
tenant=dict(),
subscription=dict(),
domain=dict(),
become_method=dict(),
become_username=dict(),
become_password=dict(no_log=True),
vault_password=dict(no_log=True),
description=dict(),
organization=dict(required=True),
project=dict(),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -174,29 +174,29 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
description = dict(),
inventory = dict(required=True),
variables = dict(),
credential = dict(),
source = dict(choices=["manual", "file", "ec2", "rax", "vmware",
argument_spec=dict(
name=dict(required=True),
description=dict(),
inventory=dict(required=True),
variables=dict(),
credential=dict(),
source=dict(choices=["manual", "file", "ec2", "rax", "vmware",
"gce", "azure", "azure_rm", "openstack",
"satellite6" , "cloudforms", "custom"], default="manual"),
source_regions = dict(),
source_vars = dict(),
instance_filters = dict(),
group_by = dict(),
source_script = dict(),
overwrite = dict(type='bool', default=False),
overwrite_vars = dict(),
update_on_launch = dict(type='bool' , default=False),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
"satellite6", "cloudforms", "custom"], default="manual"),
source_regions=dict(),
source_vars=dict(),
instance_filters=dict(),
group_by=dict(),
source_script=dict(),
overwrite=dict(type='bool', default=False),
overwrite_vars=dict(),
update_on_launch=dict(type='bool', default=False),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -126,18 +126,18 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
description = dict(),
inventory = dict(required=True),
enabled = dict(type='bool', default=True),
variables = dict(),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
name=dict(required=True),
description=dict(),
inventory=dict(required=True),
enabled=dict(type='bool', default=True),
variables=dict(),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -122,17 +122,17 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
description = dict(),
organization = dict(required=True),
variables = dict(),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
name=dict(required=True),
description=dict(),
organization=dict(required=True),
variables=dict(),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -83,12 +83,12 @@ except ImportError:
def main():
argument_spec = tower_argument_spec()
argument_spec.update(dict(
job_id = dict(type='int', required=True),
fail_if_not_running = dict(type='bool', default=False),
job_id=dict(type='int', required=True),
fail_if_not_running=dict(type='bool', default=False),
))
module = AnsibleModule(
argument_spec = argument_spec,
argument_spec=argument_spec,
supports_check_mode=True,
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -117,13 +117,13 @@ except ImportError:
def main():
argument_spec = tower_argument_spec()
argument_spec.update(dict(
job_template = dict(required=True),
job_type = dict(choices=['run', 'check', 'scan']),
inventory = dict(),
credential = dict(),
limit = dict(),
tags = dict(type='list'),
extra_vars = dict(type='list'),
job_template=dict(required=True),
job_type=dict(choices=['run', 'check', 'scan']),
inventory=dict(),
credential=dict(),
limit=dict(),
tags=dict(type='list'),
extra_vars=dict(type='list'),
))
module = AnsibleModule(

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -109,14 +109,14 @@ except ImportError:
def main():
argument_spec = tower_argument_spec()
argument_spec.update(dict(
status = dict(choices=['pending', 'waiting', 'running', 'error', 'failed', 'canceled', 'successful']),
page = dict(type='int'),
all_pages = dict(type='bool', default=False),
query = dict(type='dict'),
status=dict(choices=['pending', 'waiting', 'running', 'error', 'failed', 'canceled', 'successful']),
page=dict(type='int'),
all_pages=dict(type='bool', default=False),
query=dict(type='dict'),
))
module = AnsibleModule(
argument_spec = argument_spec,
argument_spec=argument_spec,
supports_check_mode=True
)
@ -135,7 +135,7 @@ def main():
tower_check_mode(module)
try:
job = tower_cli.get_resource('job')
params = {'status':status, 'page':page, 'all_pages': all_pages}
params = {'status': status, 'page': page, 'all_pages': all_pages}
if query:
params['query'] = query.items()
json_output = job.list(**params)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -220,7 +220,7 @@ def update_fields(p):
params = p.copy()
field_map = {
'ask_extra_vars': 'ask_variables_on_launch',
'ask_limit' :'ask_limit_on_launch',
'ask_limit': 'ask_limit_on_launch',
'ask_tags': 'ask_tags_on_launch',
'ask_job_type': 'ask_job_type_on_launch',
'machine_credential': 'credential',
@ -248,11 +248,11 @@ def update_resources(module, p):
'network_credential': 'name',
'cloud_credential': 'name',
}
for k,v in identity_map.items():
for k, v in identity_map.items():
try:
if params[k]:
key = 'credential' if '_credential' in k else k
result = tower_cli.get_resource(key).get(**{v:params[k]})
result = tower_cli.get_resource(key).get(**{v: params[k]})
params[k] = result['id']
except (exc.NotFound) as excinfo:
module.fail_json(msg='Failed to update job template: {0}'.format(excinfo), changed=False)
@ -261,36 +261,36 @@ def update_resources(module, p):
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
description = dict(),
job_type = dict(choices=['run', 'check', 'scan'], required=True),
inventory = dict(),
project = dict(required=True),
playbook = dict(required=True),
machine_credential = dict(),
cloud_credential = dict(),
network_credential = dict(),
forks = dict(type='int'),
limit = dict(),
verbosity = dict(choices=['verbose', 'debug']),
job_tags = dict(),
skip_tags = dict(),
host_config_key = dict(),
extra_vars_path = dict(type='path', required=False),
ask_extra_vars = dict(type='bool', default=False),
ask_limit = dict(type='bool', default=False),
ask_tags = dict(type='bool', default=False),
ask_job_type = dict(type='bool', default=False),
ask_inventory = dict(type='bool', default=False),
ask_credential = dict(type='bool', default=False),
become_enabled = dict(type='bool', default=False),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
name=dict(required=True),
description=dict(),
job_type=dict(choices=['run', 'check', 'scan'], required=True),
inventory=dict(),
project=dict(required=True),
playbook=dict(required=True),
machine_credential=dict(),
cloud_credential=dict(),
network_credential=dict(),
forks=dict(type='int'),
limit=dict(),
verbosity=dict(choices=['verbose', 'debug']),
job_tags=dict(),
skip_tags=dict(),
host_config_key=dict(),
extra_vars_path=dict(type='path', required=False),
ask_extra_vars=dict(type='bool', default=False),
ask_limit=dict(type='bool', default=False),
ask_tags=dict(type='bool', default=False),
ask_job_type=dict(type='bool', default=False),
ask_inventory=dict(type='bool', default=False),
ask_credential=dict(type='bool', default=False),
become_enabled=dict(type='bool', default=False),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -116,10 +116,10 @@ except ImportError:
def main():
argument_spec = tower_argument_spec()
argument_spec.update(dict(
job_id = dict(type='int', required=True),
timeout = dict(type='int'),
min_interval = dict(type='float', default=1),
max_interval = dict(type='float', default=30),
job_id=dict(type='int', required=True),
timeout=dict(type='int'),
min_interval=dict(type='float', default=1),
max_interval=dict(type='float', default=30),
))
module = AnsibleModule(

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -112,15 +112,15 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
organization = dict(required=True),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
name=dict(required=True),
organization=dict(required=True),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -111,15 +111,15 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
description = dict(),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
name=dict(required=True),
description=dict(),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -159,25 +159,25 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(),
description = dict(),
organization = dict(),
scm_type = dict(choices=['manual', 'git', 'hg', 'svn'], default='manual'),
scm_url = dict(),
scm_branch = dict(),
scm_credential = dict(),
scm_clean = dict(type='bool', default=False),
scm_delete_on_update = dict(type='bool', default=False),
scm_update_on_launch = dict(type='bool', default=False),
local_path = dict(),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
argument_spec=dict(
name=dict(),
description=dict(),
organization=dict(),
scm_type=dict(choices=['manual', 'git', 'hg', 'svn'], default='manual'),
scm_url=dict(),
scm_branch=dict(),
scm_credential=dict(),
scm_clean=dict(type='bool', default=False),
scm_delete_on_update=dict(type='bool', default=False),
scm_update_on_launch=dict(type='bool', default=False),
local_path=dict(),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -152,20 +152,20 @@ def update_resources(module, p):
'''
params = p.copy()
identity_map = {
'user':'username',
'team':'name',
'target_team':'name',
'inventory':'name',
'job_template':'name',
'credential':'name',
'organization':'name',
'project':'name',
'user': 'username',
'team': 'name',
'target_team': 'name',
'inventory': 'name',
'job_template': 'name',
'credential': 'name',
'organization': 'name',
'project': 'name',
}
for k,v in identity_map.items():
for k, v in identity_map.items():
try:
if params[k]:
key = 'team' if k == 'target_team' else k
result = tower_cli.get_resource(key).get(**{v:params[k]})
result = tower_cli.get_resource(key).get(**{v: params[k]})
params[k] = result['id']
except (exc.NotFound) as excinfo:
module.fail_json(msg='Failed to update role, {0} not found: {1}'.format(k, excinfo), changed=False)
@ -174,22 +174,22 @@ def update_resources(module, p):
def main():
module = AnsibleModule(
argument_spec = dict(
user = dict(),
team = dict(),
role = dict(choices=["admin", "read", "member", "execute", "adhoc", "update", "use", "auditor"]),
target_team = dict(),
inventory = dict(),
job_template = dict(),
credential = dict(),
organization = dict(),
project = dict(),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
user=dict(),
team=dict(),
role=dict(choices=["admin", "read", "member", "execute", "adhoc", "update", "use", "auditor"]),
target_team=dict(),
inventory=dict(),
job_template=dict(),
credential=dict(),
organization=dict(),
project=dict(),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -113,16 +113,16 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
name = dict(required=True),
description = dict(),
organization = dict(required=True),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
name=dict(required=True),
description=dict(),
organization=dict(required=True),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -1,5 +1,5 @@
#!/usr/bin/python
#coding: utf-8 -*-
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
@ -143,21 +143,21 @@ except ImportError:
def main():
module = AnsibleModule(
argument_spec = dict(
username = dict(required=True),
first_name = dict(),
last_name = dict(),
password = dict(no_log=True),
email = dict(required=True),
organization = dict(),
superuser = dict(type='bool', default=False),
auditor = dict(type='bool', default=False),
tower_host = dict(),
tower_username = dict(),
tower_password = dict(no_log=True),
tower_verify_ssl = dict(type='bool', default=True),
tower_config_file = dict(type='path'),
state = dict(choices=['present', 'absent'], default='present'),
argument_spec=dict(
username=dict(required=True),
first_name=dict(),
last_name=dict(),
password=dict(no_log=True),
email=dict(required=True),
organization=dict(),
superuser=dict(type='bool', default=False),
auditor=dict(type='bool', default=False),
tower_host=dict(),
tower_username=dict(),
tower_password=dict(no_log=True),
tower_verify_ssl=dict(type='bool', default=True),
tower_config_file=dict(type='path'),
state=dict(choices=['present', 'absent'], default='present'),
),
supports_check_mode=True
)

View file

@ -702,21 +702,6 @@ lib/ansible/modules/utilities/helper/_accelerate.py
lib/ansible/modules/utilities/logic/async_status.py
lib/ansible/modules/utilities/logic/async_wrapper.py
lib/ansible/modules/utilities/logic/wait_for.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_cancel.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py
lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py
lib/ansible/modules/web_infrastructure/ejabberd_user.py
lib/ansible/modules/web_infrastructure/jboss.py
lib/ansible/parsing/dataloader.py