From bd69198185a77a7f7d09fa91bb65fd8357275543 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 13 Jan 2016 10:40:49 +0000 Subject: [PATCH] Resolve pep8 violations caught by pep8 v1.7.0 This patch resolves new pep8 violations caught by pep8 v1.7.0. Change-Id: Ib1f1681d2872830f9c240e43d472f42b79a432a0 --- playbooks/library/dist_sort | 4 ++-- playbooks/library/glance | 13 ++++++++----- playbooks/library/keystone | 4 ++-- playbooks/library/memcached | 4 ++-- playbooks/library/name2int | 12 +++++++----- playbooks/library/neutron | 13 ++++++++----- playbooks/library/provider_networks | 7 +++++-- playbooks/roles/os_keystone/library/keystone_sp | 7 +++++-- scripts/inventory-manage.py | 4 ++-- 9 files changed, 41 insertions(+), 27 deletions(-) diff --git a/playbooks/library/dist_sort b/playbooks/library/dist_sort index 71cd48a4e8..d4d1039a1d 100644 --- a/playbooks/library/dist_sort +++ b/playbooks/library/dist_sort @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# import module snippets +from ansible.module_utils.basic import * DOCUMENTATION = """ --- @@ -162,7 +164,5 @@ def main(): resp.update(module.params) module.fail_json(msg='Failed Process', **resp) -# import module snippets -from ansible.module_utils.basic import * if __name__ == '__main__': main() diff --git a/playbooks/library/glance b/playbooks/library/glance index 13b562845c..73e5997d32 100644 --- a/playbooks/library/glance +++ b/playbooks/library/glance @@ -13,6 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. + +import glanceclient.client as glclient +import keystoneclient.v3.client as ksclient + +# import module snippets +from ansible.module_utils.basic import * + + DOCUMENTATION = """ --- module: glance @@ -86,10 +94,6 @@ EXAMPLES = """ """ -import glanceclient.client as glclient -import keystoneclient.v3.client as ksclient - - COMMAND_MAP = {'image-list': 'list_images', 'image-create': 'create_image'} @@ -228,6 +232,5 @@ def main(): mg = ManageGlance(module) mg.route() -from ansible.module_utils.basic import * if __name__ == '__main__': main() diff --git a/playbooks/library/keystone b/playbooks/library/keystone index d6bd74678f..e9d04be936 100644 --- a/playbooks/library/keystone +++ b/playbooks/library/keystone @@ -881,8 +881,8 @@ class ManageKeystone(object): # NOTE(sigmavirus24): Try to get the project_name, but # don't error out on it. This will change when the playbooks are # updated to use project_name instead of tenant_name - project_name = (variables_dict.pop('project_name', None) - or variables_dict.pop('tenant_name')) + project_name = (variables_dict.pop('project_name', None) or + variables_dict.pop('tenant_name')) role_name = variables_dict.pop('role_name') user, project, role, group = self._get_role_data( diff --git a/playbooks/library/memcached b/playbooks/library/memcached index cf945288df..5208fdd14a 100644 --- a/playbooks/library/memcached +++ b/playbooks/library/memcached @@ -29,6 +29,8 @@ try: except ImportError: ENCRYPT_IMPORT = False +# import module snippets +from ansible.module_utils.basic import * DOCUMENTATION = """ --- @@ -592,7 +594,5 @@ def main(): ms = Memcached(module=module) ms.router() -# import module snippets -from ansible.module_utils.basic import * if __name__ == '__main__': main() diff --git a/playbooks/library/name2int b/playbooks/library/name2int index 52cce3e596..5759adc3ea 100644 --- a/playbooks/library/name2int +++ b/playbooks/library/name2int @@ -15,6 +15,13 @@ # See the License for the specific language governing permissions and # limitations under the License. + +import hashlib +import platform + +# import module snippets +from ansible.module_utils.basic import * + DOCUMENTATION = """ --- module: name2int @@ -37,9 +44,6 @@ EXAMPLES = """ name: "Some-hostname.com" """ -import hashlib -import platform - class HashHostname(object): def __init__(self, module): @@ -71,7 +75,5 @@ def main(): resp = {'stderr': exp} module.fail_json(msg='Failed Process', **resp) -# import module snippets -from ansible.module_utils.basic import * if __name__ == '__main__': main() diff --git a/playbooks/library/neutron b/playbooks/library/neutron index baf91a15b8..c5dbc6df4a 100644 --- a/playbooks/library/neutron +++ b/playbooks/library/neutron @@ -13,6 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. + +import keystoneclient.v3.client as ksclient +from neutronclient.neutron import client as nclient + +# import module snippets +from ansible.module_utils.basic import * + + DOCUMENTATION = """ --- module: neutron @@ -114,10 +122,6 @@ EXAMPLES = """ """ -import keystoneclient.v3.client as ksclient -from neutronclient.neutron import client as nclient - - COMMAND_MAP = { 'create_network': { 'variables': [ @@ -414,6 +418,5 @@ def main(): mn = ManageNeutron(module) mn.command_router() -from ansible.module_utils.basic import * if __name__ == '__main__': main() diff --git a/playbooks/library/provider_networks b/playbooks/library/provider_networks index 68d23ac062..d3aefa7039 100644 --- a/playbooks/library/provider_networks +++ b/playbooks/library/provider_networks @@ -15,6 +15,11 @@ # See the License for the specific language governing permissions and # limitations under the License. + +# import module snippets +from ansible.module_utils.basic import * + + DOCUMENTATION = """ --- module: provider_networks @@ -274,7 +279,5 @@ def main(): resp = {'stderr': exp} module.fail_json(msg='Failed Process', **resp) -# import module snippets -from ansible.module_utils.basic import * if __name__ == '__main__': main() diff --git a/playbooks/roles/os_keystone/library/keystone_sp b/playbooks/roles/os_keystone/library/keystone_sp index da6e73dfef..9b7081e1bc 100644 --- a/playbooks/roles/os_keystone/library/keystone_sp +++ b/playbooks/roles/os_keystone/library/keystone_sp @@ -15,6 +15,11 @@ # See the License for the specific language governing permissions and # limitations under the License. + +# import module snippets +from ansible.module_utils.basic import * + + DOCUMENTATION = """ --- module: keystone_sp @@ -111,7 +116,5 @@ def main(): resp = {'stderr': exp} module.fail_json(msg='Failed Process', **resp) -# import module snippets -from ansible.module_utils.basic import * if __name__ == '__main__': main() diff --git a/scripts/inventory-manage.py b/scripts/inventory-manage.py index b7e403b447..139fce129b 100755 --- a/scripts/inventory-manage.py +++ b/scripts/inventory-manage.py @@ -180,8 +180,8 @@ def get_groups_for_container(inventory, container_name): # Beware, this dictionary comprehension requires Python 2.7, but we should # have this on openstack-ansible hosts already. groups = {k for (k, v) in inventory.items() if - ('hosts' in v - and container_name in v['hosts'])} + ('hosts' in v and + container_name in v['hosts'])} return groups