From 728d3e6c84a8bae9054d24cc20aa6399d3bfd264 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 11 May 2017 21:56:36 +0530 Subject: [PATCH] Pep8 fixes for web_infra/ansible_tower (#24479) Signed-off-by: Abhijeet Kasurde --- .../ansible_tower/tower_credential.py | 66 +++++++++--------- .../ansible_tower/tower_group.py | 48 ++++++------- .../ansible_tower/tower_host.py | 28 ++++---- .../ansible_tower/tower_inventory.py | 26 +++---- .../ansible_tower/tower_job_cancel.py | 8 +-- .../ansible_tower/tower_job_launch.py | 16 ++--- .../ansible_tower/tower_job_list.py | 14 ++-- .../ansible_tower/tower_job_template.py | 68 +++++++++---------- .../ansible_tower/tower_job_wait.py | 10 +-- .../ansible_tower/tower_label.py | 20 +++--- .../ansible_tower/tower_organization.py | 20 +++--- .../ansible_tower/tower_project.py | 38 +++++------ .../ansible_tower/tower_role.py | 54 +++++++-------- .../ansible_tower/tower_team.py | 24 +++---- .../ansible_tower/tower_user.py | 36 +++++----- test/sanity/pep8/legacy-files.txt | 15 ---- 16 files changed, 238 insertions(+), 253 deletions(-) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py index be1fc7f43a1..ff796ceca35 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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, - 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'), + 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'), ), supports_check_mode=True ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py index 646c3f9ca42..bc36a7f878c 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_group.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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", - "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'), + 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'), ), supports_check_mode=True ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py index 6d9d129de01..65dfa6eecdf 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_host.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) @@ -170,7 +170,7 @@ def main(): if state == 'present': result = host.modify(name=name, inventory=inv['id'], enabled=enabled, - variables=variables, description=description, create_on_missing=True) + variables=variables, description=description, create_on_missing=True) json_output['id'] = result['id'] elif state == 'absent': result = host.delete(name=name, inventory=inv['id']) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py index 60af48c7a15..0ab57048941 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_inventory.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) @@ -159,7 +159,7 @@ def main(): if state == 'present': result = inventory.modify(name=name, organization=org['id'], variables=variables, - description=description, create_on_missing=True) + description=description, create_on_missing=True) json_output['id'] = result['id'] elif state == 'absent': result = inventory.delete(name=name, organization=org['id']) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_cancel.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_cancel.py index 8cb8fabab22..0d99242f5eb 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_cancel.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_cancel.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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, ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py index 2a0d8ac2f2c..9d2cedef74f 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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( diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py index 0c259931cd4..bdc1a272c99 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_list.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py index 13d4e99064f..aa351d91587 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_template.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py index 9a9e21dfa2f..7c74e5f1f0e 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_wait.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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( diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py index e0a0c6c3ee4..fd1a296b97a 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_label.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py index 0b537e45cb6..65741860cc7 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_organization.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py index 7d5048c95b9..30b25d1c086 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py index 49799ab1ff5..04932d82a67 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_role.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py index d025317afe0..3eaefa036cd 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_team.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) @@ -148,7 +148,7 @@ def main(): if state == 'present': result = team.modify(name=name, organization=org['id'], - description=description, create_on_missing=True) + description=description, create_on_missing=True) json_output['id'] = result['id'] elif state == 'absent': result = team.delete(name=name, organization=org['id']) diff --git a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py index 106ae038ee5..fe04fde5ab6 100644 --- a/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py +++ b/lib/ansible/modules/web_infrastructure/ansible_tower/tower_user.py @@ -1,5 +1,5 @@ #!/usr/bin/python -#coding: utf-8 -*- +# coding: utf-8 -*- # (c) 2017, Wayne Witzel III # @@ -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 ) @@ -184,8 +184,8 @@ def main(): try: if state == 'present': result = user.modify(username=username, first_name=first_name, last_name=last_name, - email=email, password=password, organization=organization, - is_superuser=superuser, is_auditor=auditor, create_on_missing=True) + email=email, password=password, organization=organization, + is_superuser=superuser, is_auditor=auditor, create_on_missing=True) json_output['id'] = result['id'] elif state == 'absent': result = user.delete(username=username) diff --git a/test/sanity/pep8/legacy-files.txt b/test/sanity/pep8/legacy-files.txt index 7e804c349cc..bd250c41785 100644 --- a/test/sanity/pep8/legacy-files.txt +++ b/test/sanity/pep8/legacy-files.txt @@ -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