From 5ae62b53ceac0e86f6286cc3d196420a908c9c1a Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 10 Sep 2019 14:59:04 +0300 Subject: [PATCH] Make modern flake8 happy about our code In order to fit modern flake8, some minor changes required for scripts Change-Id: Ic3a02c6c19d230ca6edb6b068a03044225cd9fc4 --- osa_toolkit/generate.py | 9 ++++----- osa_toolkit/manage.py | 6 +++--- scripts/fastest-infra-wheel-mirror.py | 1 + scripts/gen-config.py | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osa_toolkit/generate.py b/osa_toolkit/generate.py index a567f94458..59d327e244 100755 --- a/osa_toolkit/generate.py +++ b/osa_toolkit/generate.py @@ -606,9 +606,8 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface, container = base_hosts[container_host] physical_host = container.get('physical_host') - if (reference_group and - physical_host not in - inventory.get(reference_group).get('hosts')): + if (reference_group and physical_host + not in inventory.get(reference_group).get('hosts')): continue # TODO(cloudnull) after a few releases this should be removed. @@ -1025,8 +1024,8 @@ def _check_config_settings(cidr_networks, config, container_skel): raise SystemExit( "can't find " + q_name + " in cidr_networks" ) - if (p_net.get('container_bridge') == - overrides.get('management_bridge')): + if (p_net.get('container_bridge') == overrides.get( + 'management_bridge')): if not p_net.get('is_container_address'): raise ProviderNetworkMisconfiguration(q_name) diff --git a/osa_toolkit/manage.py b/osa_toolkit/manage.py index d8c2b35586..c8d5f9b3b8 100644 --- a/osa_toolkit/manage.py +++ b/osa_toolkit/manage.py @@ -133,9 +133,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'])} + groups = {k for (k, v) in inventory.items() + if ('hosts' in v and container_name in v['hosts'])} return groups @@ -352,5 +351,6 @@ def main(): remove_inventory_item(user_args['remove_item'], inventory, filepath) print('Success. . .') + if __name__ == "__main__": main() diff --git a/scripts/fastest-infra-wheel-mirror.py b/scripts/fastest-infra-wheel-mirror.py index ae6e4b5d98..e19dfecb29 100755 --- a/scripts/fastest-infra-wheel-mirror.py +++ b/scripts/fastest-infra-wheel-mirror.py @@ -131,6 +131,7 @@ def TestUrl(workQueue, resultQueue): # Subthread returned a time. Store it. resultQueue.put((url, result[0])) + # Set the number of threads to use numThreads = min(MAX_THREADS, len(MIRROR_LIST)) diff --git a/scripts/gen-config.py b/scripts/gen-config.py index 64f47dbce2..f879ce7fcd 100755 --- a/scripts/gen-config.py +++ b/scripts/gen-config.py @@ -52,6 +52,7 @@ def args(arg_list): return vars(parser.parse_args(arg_list)) + if __name__ == "__main__": script_args = args(sys.argv[1:])