From 3a419fef8db95b161ac6f3715c0403fa5b47573f Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Wed, 5 Sep 2018 11:38:38 -0500 Subject: [PATCH] Cleanup several pep8 warnings The following pep8/flake8 warnings are no longer being suppressed: E101 indentation contains mixed spaces and tabs E203 whitespace before ':' E211 whitespace before '(' E228 missing whitespace around modulo operator E251 unexpected spaces around keyword / parameter equal E302 expected 2 blank lines, found 1 E303 too many blank lines Story: 2003499 Task: 26190 Change-Id: I8df57783417e4372a008f876365f9c24d2c0cb4b Signed-off-by: Al Bailey --- nfv/nfv-common/nfv_common/forensic/_defs.py | 1 + .../histogram_analysis/Histogram.py | 1 + .../histogram_analysis/plotter.py | 24 +-- .../nfv_unit_tests/tests/test_instance.py | 1 - .../tests/test_sw_patch_strategy.py | 170 +++++++++--------- .../tests/test_sw_upgrade_strategy.py | 54 +++--- .../nova_api_proxy/common/exception.py | 1 + tox.ini | 9 +- 8 files changed, 128 insertions(+), 133 deletions(-) diff --git a/nfv/nfv-common/nfv_common/forensic/_defs.py b/nfv/nfv-common/nfv_common/forensic/_defs.py index 2f649b98..9d6ae1bf 100755 --- a/nfv/nfv-common/nfv_common/forensic/_defs.py +++ b/nfv/nfv-common/nfv_common/forensic/_defs.py @@ -6,6 +6,7 @@ # flake8: noqa # + class _NfvVimRecordType(object): """ NFV-VIM Record Type Constants diff --git a/nfv/nfv-debug-tools/histogram_analysis/Histogram.py b/nfv/nfv-debug-tools/histogram_analysis/Histogram.py index 01e3500b..123026c2 100755 --- a/nfv/nfv-debug-tools/histogram_analysis/Histogram.py +++ b/nfv/nfv-debug-tools/histogram_analysis/Histogram.py @@ -56,6 +56,7 @@ if not os.path.exists(logDir): call("cp nfv-vim.log nfv-vim.log.[0-9] nfv-vim.log.[0-9][0-9] nfv-vim.log.[0-9].gz nfv-vim.log.[0-9][0-9].gz logs/", shell=True) call("gunzip logs/nfv-vim.log.[0-9].gz logs/nfv-vim.log.[0-9][0-9].gz", shell=True) + class Parser: def __init__(self): self.proc="" # Name of process being read diff --git a/nfv/nfv-debug-tools/histogram_analysis/plotter.py b/nfv/nfv-debug-tools/histogram_analysis/plotter.py index d9478c1a..c46874a9 100755 --- a/nfv/nfv-debug-tools/histogram_analysis/plotter.py +++ b/nfv/nfv-debug-tools/histogram_analysis/plotter.py @@ -70,6 +70,7 @@ group=[] graphName="" plotType="" + def helpMessage(): print("\n"+"-"*120) print("NFV-VIM Histogram Graphing Script\n") @@ -207,7 +208,7 @@ def gCommand(groups): break else: if not groupFound: - warnings.append("WARNING: The following group could not be found: %s\n\t\t Please check your logplot.cfg file for the intended group name."%(g,)) + warnings.append("WARNING: The following group could not be found: %s\n\t\t Please check your logplot.cfg file for the intended group name." % (g,)) f.close() return procs @@ -229,7 +230,7 @@ def pCommand(pList): procList.append(pList[i]) else: while(not isFile): - print("\nFiles containing keyword: %s"%(str(procName))) + print("\nFiles containing keyword: %s" % (str(procName))) csvFile=str(procName)+".csv" for root, directories, filenames in os.walk(pth): for filename in filenames: @@ -274,10 +275,10 @@ def storeGraphData(procs, dateRange=[], execTime=False, hits=False, plots=1): f.close() hitList[i][0]=None graphData['trace'+str(i)] = go.Scatter( - x = dateList[i], - y = timeList[i] if execTime else hitList[i], - mode = plotType, - name = (procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits"))) + x=dateList[i], + y=timeList[i] if execTime else hitList[i], + mode=plotType, + name=(procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits"))) ) if plots==1: fig.append_trace(graphData['trace'+str(i)], 1, 1) @@ -297,10 +298,10 @@ def storeGraphData(procs, dateRange=[], execTime=False, hits=False, plots=1): f.close() hitList[i][0]=None graphData['trace'+str(i)] = go.Scatter( - x = dateList[i], - y = timeList[i] if execTime else hitList[i], - mode = plotType, - name = (procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits"))) + x=dateList[i], + y=timeList[i] if execTime else hitList[i], + mode=plotType, + name=(procs[i] if not oneAxis else (procs[i]+"_"+("time" if execTime else "hits"))) ) if plots==1: fig.append_trace(graphData['trace'+str(i)], 1, 1) @@ -363,7 +364,6 @@ def setFilename(graphName): return graphName - print("Welcome to plotter, type --help for information") # Checks that plotly is installed, otherwise graphs cannot be generated. plotCheck=commands.getstatusoutput("pip list | grep plotly") @@ -465,7 +465,7 @@ if config: if os.path.exists(os.path.join(pth,csvFile)): procs.append(cfgLine[0]) else: - warnings.append("WARNING: %s does not exist."%(csvFile,)) + warnings.append("WARNING: %s does not exist." % (csvFile,)) f.close() # If both average execution time and delta hits are specified to be shown, generate two graphs if -oneaxis wasn't specified. diff --git a/nfv/nfv-tests/nfv_unit_tests/tests/test_instance.py b/nfv/nfv-tests/nfv_unit_tests/tests/test_instance.py index a188ddca..2628122c 100755 --- a/nfv/nfv-tests/nfv_unit_tests/tests/test_instance.py +++ b/nfv/nfv-tests/nfv_unit_tests/tests/test_instance.py @@ -291,7 +291,6 @@ class TestInstance: 'compute-0') assert 300 == instance.max_live_migrate_wait_in_secs - def test_live_migration_completion_timeout_from_image(self): create_instance_type('small') create_image('image_0', diff --git a/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_patch_strategy.py b/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_patch_strategy.py index 052885cf..fb9ad54b 100755 --- a/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_patch_strategy.py +++ b/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_patch_strategy.py @@ -171,9 +171,9 @@ def create_host_aggregate(name, host_names): global _host_aggregate_table nfvi_host_aggregate = nfvi.objects.v1.HostAggregate( - name = name, - host_names = host_names, - availability_zone = '' + name=name, + host_names=host_names, + availability_zone='' ) host_aggregate = objects.HostAggregate(nfvi_host_aggregate) @@ -366,8 +366,8 @@ class TestSwPatchStrategy: ) success, reason = strategy._add_compute_strategy_stages( - compute_hosts = sorted_compute_hosts, - reboot = True) + compute_hosts=sorted_compute_hosts, + reboot=True) assert success == True, "Strategy creation failed" @@ -418,8 +418,8 @@ class TestSwPatchStrategy: max_parallel_compute_hosts=2 ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -528,8 +528,8 @@ class TestSwPatchStrategy: max_parallel_compute_hosts=2 ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -691,8 +691,8 @@ class TestSwPatchStrategy: max_parallel_compute_hosts=2 ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -864,8 +864,8 @@ class TestSwPatchStrategy: max_parallel_compute_hosts=2 ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1029,8 +1029,8 @@ class TestSwPatchStrategy: max_parallel_compute_hosts=2 ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1180,8 +1180,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1270,7 +1270,7 @@ class TestSwPatchStrategy: create_instance('small', "test_instance_1", 'compute-1', - admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) create_instance_group('instance_group_1', ['test_instance_0', 'test_instance_1'], @@ -1289,8 +1289,8 @@ class TestSwPatchStrategy: ) success, reason = strategy._add_compute_strategy_stages( - compute_hosts = sorted_compute_hosts, - reboot = True) + compute_hosts=sorted_compute_hosts, + reboot=True) assert success == False, "Strategy creation did not fail" @@ -1331,8 +1331,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1405,11 +1405,11 @@ class TestSwPatchStrategy: strategy = create_sw_patch_strategy( compute_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL, default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START, - max_parallel_compute_hosts = 3, + max_parallel_compute_hosts=3, ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = False) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=False) apply_phase = strategy.apply_phase.as_dict() @@ -1457,7 +1457,7 @@ class TestSwPatchStrategy: create_host('compute-1') create_host('compute-2') create_host('compute-3', - admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) create_instance('small', "test_instance_0", @@ -1479,8 +1479,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1551,7 +1551,7 @@ class TestSwPatchStrategy: create_instance('small', "test_instance_1", 'compute-1', - admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) compute_hosts = [] for host in _host_table.values(): @@ -1566,8 +1566,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1665,8 +1665,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1744,8 +1744,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1836,8 +1836,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1925,8 +1925,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = False) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=False) apply_phase = strategy.apply_phase.as_dict() @@ -1940,7 +1940,7 @@ class TestSwPatchStrategy: {'name': 'sw-patch-hosts', 'entity_names': ['compute-2']}, {'name': 'system-stabilize', - 'timeout' : 30} + 'timeout': 30} ] }, {'name': 'sw-patch-compute-hosts', @@ -1950,7 +1950,7 @@ class TestSwPatchStrategy: {'name': 'sw-patch-hosts', 'entity_names': ['compute-3']}, {'name': 'system-stabilize', - 'timeout' : 30} + 'timeout': 30} ] }, {'name': 'sw-patch-compute-hosts', @@ -1960,7 +1960,7 @@ class TestSwPatchStrategy: {'name': 'sw-patch-hosts', 'entity_names': ['compute-0']}, {'name': 'system-stabilize', - 'timeout' : 30} + 'timeout': 30} ] }, {'name': 'sw-patch-compute-hosts', @@ -1970,7 +1970,7 @@ class TestSwPatchStrategy: {'name': 'sw-patch-hosts', 'entity_names': ['compute-1']}, {'name': 'system-stabilize', - 'timeout' : 30} + 'timeout': 30} ] } ] @@ -1993,7 +1993,7 @@ class TestSwPatchStrategy: create_host('compute-0') create_host('compute-1') create_host('compute-2', - admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) create_host('compute-3') create_instance('small', @@ -2023,8 +2023,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -2117,8 +2117,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = False) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=False) apply_phase = strategy.apply_phase.as_dict() @@ -2195,8 +2195,8 @@ class TestSwPatchStrategy: max_parallel_compute_hosts=5 ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -2325,8 +2325,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.MIGRATE ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -2488,7 +2488,7 @@ class TestSwPatchStrategy: create_instance('small', "test_instance_0", 'compute-0', - admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) create_instance('small', "test_instance_1", 'compute-1') @@ -2511,8 +2511,8 @@ class TestSwPatchStrategy: ) success, reason = strategy._add_compute_strategy_stages( - compute_hosts = sorted_compute_hosts, - reboot = True) + compute_hosts=sorted_compute_hosts, + reboot=True) assert success == False, "Strategy creation did not fail" @@ -2608,8 +2608,8 @@ class TestSwPatchStrategy: ) success, reason = strategy._add_storage_strategy_stages( - storage_hosts = sorted_storage_hosts, - reboot = True) + storage_hosts=sorted_storage_hosts, + reboot=True) assert success == True, "Strategy creation failed" @@ -2654,8 +2654,8 @@ class TestSwPatchStrategy: storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL ) - strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, - reboot = True) + strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -2715,8 +2715,8 @@ class TestSwPatchStrategy: storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL ) - strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, - reboot = False) + strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts, + reboot=False) apply_phase = strategy.apply_phase.as_dict() @@ -2777,8 +2777,8 @@ class TestSwPatchStrategy: storage_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL ) - strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, - reboot = True) + strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -2900,8 +2900,8 @@ class TestSwPatchStrategy: ) success, reason = strategy._add_controller_strategy_stages( - controllers = controller_hosts, - reboot = True) + controllers=controller_hosts, + reboot=True) assert success == True, "Strategy creation failed" apply_phase = strategy.apply_phase.as_dict() @@ -2934,8 +2934,8 @@ class TestSwPatchStrategy: controller_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL ) - strategy._add_controller_strategy_stages(controllers = controller_hosts, - reboot = True) + strategy._add_controller_strategy_stages(controllers=controller_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -2989,8 +2989,8 @@ class TestSwPatchStrategy: controller_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL ) - strategy._add_controller_strategy_stages(controllers = controller_hosts, - reboot = False) + strategy._add_controller_strategy_stages(controllers=controller_hosts, + reboot=False) apply_phase = strategy.apply_phase.as_dict() @@ -3054,8 +3054,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -3118,8 +3118,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = False) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=False) apply_phase = strategy.apply_phase.as_dict() @@ -3179,8 +3179,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -3260,8 +3260,8 @@ class TestSwPatchStrategy: default_instance_action=SW_UPDATE_INSTANCE_ACTION.STOP_START ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -3283,7 +3283,7 @@ class TestSwPatchStrategy: {'name': 'unlock-hosts', 'entity_names': ['controller-0']}, {'name': 'system-stabilize', - 'timeout' : 60} + 'timeout': 60} ] }, {'name': 'sw-patch-compute-hosts', @@ -3301,7 +3301,7 @@ class TestSwPatchStrategy: {'name': 'unlock-hosts', 'entity_names': ['controller-1']}, {'name': 'system-stabilize', - 'timeout' : 60} + 'timeout': 60} ] }, ] @@ -3340,8 +3340,8 @@ class TestSwPatchStrategy: ) success, reason = strategy._add_compute_strategy_stages( - compute_hosts = compute_hosts, - reboot = True) + compute_hosts=compute_hosts, + reboot=True) assert success == False, "Strategy creation did not fail" @@ -3369,8 +3369,8 @@ class TestSwPatchStrategy: single_controller=True ) - strategy._add_compute_strategy_stages(compute_hosts = compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -3424,8 +3424,8 @@ class TestSwPatchStrategy: single_controller=True ) - strategy._add_compute_strategy_stages(compute_hosts = compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() diff --git a/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_upgrade_strategy.py b/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_upgrade_strategy.py index 629b6293..8b8dfb76 100755 --- a/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_upgrade_strategy.py +++ b/nfv/nfv-tests/nfv_unit_tests/tests/test_sw_upgrade_strategy.py @@ -373,8 +373,8 @@ class TestSwUpgradeStrategy: ) success, reason = strategy._add_compute_strategy_stages( - compute_hosts = sorted_compute_hosts, - reboot = True) + compute_hosts=sorted_compute_hosts, + reboot=True) assert success == True, "Strategy creation failed" @@ -427,8 +427,8 @@ class TestSwUpgradeStrategy: ) strategy._add_compute_strategy_stages( - compute_hosts = sorted_compute_hosts, - reboot = True) + compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -756,8 +756,8 @@ class TestSwUpgradeStrategy: compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL ) - strategy._add_compute_strategy_stages(compute_hosts = sorted_compute_hosts, - reboot = True) + strategy._add_compute_strategy_stages(compute_hosts=sorted_compute_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -845,7 +845,7 @@ class TestSwUpgradeStrategy: create_instance('small', "test_instance_0", 'compute-0', - admin_state = nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.INSTANCE_ADMIN_STATE.LOCKED) create_instance('small', "test_instance_1", 'compute-1') @@ -866,8 +866,8 @@ class TestSwUpgradeStrategy: ) success, reason = strategy._add_compute_strategy_stages( - compute_hosts = sorted_compute_hosts, - reboot = True) + compute_hosts=sorted_compute_hosts, + reboot=True) assert success == False, "Strategy creation did not fail" @@ -904,8 +904,8 @@ class TestSwUpgradeStrategy: ) success, reason = strategy._add_storage_strategy_stages( - storage_hosts = sorted_storage_hosts, - reboot = True) + storage_hosts=sorted_storage_hosts, + reboot=True) assert success == True, "Strategy creation failed" @@ -951,8 +951,8 @@ class TestSwUpgradeStrategy: storage_apply_type=SW_UPDATE_APPLY_TYPE.PARALLEL ) - strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, - reboot = True) + strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1037,8 +1037,8 @@ class TestSwUpgradeStrategy: storage_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL ) - strategy._add_storage_strategy_stages(storage_hosts = sorted_storage_hosts, - reboot = True) + strategy._add_storage_strategy_stages(storage_hosts=sorted_storage_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1131,8 +1131,8 @@ class TestSwUpgradeStrategy: strategy = create_sw_upgrade_strategy() - strategy._add_controller_strategy_stages(controllers = controller_hosts, - reboot = True) + strategy._add_controller_strategy_stages(controllers=controller_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1179,8 +1179,8 @@ class TestSwUpgradeStrategy: strategy = create_sw_upgrade_strategy() - strategy._add_controller_strategy_stages(controllers = controller_hosts, - reboot = True) + strategy._add_controller_strategy_stages(controllers=controller_hosts, + reboot=True) apply_phase = strategy.apply_phase.as_dict() @@ -1247,8 +1247,8 @@ class TestSwUpgradeStrategy: strategy = create_sw_upgrade_strategy() success, reason = strategy._add_controller_strategy_stages( - controllers = controller_hosts, - reboot = True) + controllers=controller_hosts, + reboot=True) assert success == False, "Strategy creation did not fail" assert reason == "cannot apply software upgrades to CPE configuration", \ @@ -1541,7 +1541,7 @@ class TestSwUpgradeStrategy: strategy = create_sw_upgrade_strategy( compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, - nfvi_upgrade = nfvi.objects.v1.Upgrade( + nfvi_upgrade=nfvi.objects.v1.Upgrade( UPGRADE_STATE.DATA_MIGRATION_COMPLETE, '12.01', '13.01') @@ -1627,7 +1627,7 @@ class TestSwUpgradeStrategy: strategy = create_sw_upgrade_strategy( compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, - nfvi_upgrade = nfvi.objects.v1.Upgrade( + nfvi_upgrade=nfvi.objects.v1.Upgrade( UPGRADE_STATE.DATA_MIGRATION_COMPLETE, '12.01', '13.01') @@ -1672,7 +1672,7 @@ class TestSwUpgradeStrategy: strategy = create_sw_upgrade_strategy( compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, - nfvi_upgrade = nfvi.objects.v1.Upgrade( + nfvi_upgrade=nfvi.objects.v1.Upgrade( UPGRADE_STATE.UPGRADING_CONTROLLERS, '12.01', '13.01') @@ -1703,7 +1703,7 @@ class TestSwUpgradeStrategy: - build fails """ create_host('controller-0', - admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) create_host('controller-1') create_host('compute-0') create_host('compute-1') @@ -1754,7 +1754,7 @@ class TestSwUpgradeStrategy: create_host('compute-1') create_host('compute-2') create_host('compute-3', - admin_state = nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) + admin_state=nfvi.objects.v1.HOST_ADMIN_STATE.LOCKED) create_instance('small', "test_instance_0", @@ -1765,7 +1765,7 @@ class TestSwUpgradeStrategy: strategy = create_sw_upgrade_strategy( compute_apply_type=SW_UPDATE_APPLY_TYPE.SERIAL, - nfvi_upgrade = nfvi.objects.v1.Upgrade( + nfvi_upgrade=nfvi.objects.v1.Upgrade( UPGRADE_STATE.UPGRADING_CONTROLLERS, '12.01', '13.01') diff --git a/nova-api-proxy/nova-api-proxy/nova_api_proxy/common/exception.py b/nova-api-proxy/nova-api-proxy/nova_api_proxy/common/exception.py index 06cd598b..009803c2 100644 --- a/nova-api-proxy/nova-api-proxy/nova_api_proxy/common/exception.py +++ b/nova-api-proxy/nova-api-proxy/nova_api_proxy/common/exception.py @@ -21,6 +21,7 @@ # # + class ProxyException(Exception): """Base Exception """ diff --git a/tox.ini b/tox.ini index 6d940e00..6c1edb58 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,6 @@ commands = [pep8] # Temporarily ignoring these warnings -# E101 indentation contains mixed spaces and tabs # E116 unexpected indentation (comment) # E121 continuation line under-indented for hanging indent # E122 continuation line missing indentation or outdented @@ -36,22 +35,16 @@ commands = # E127 continuation line over-indented for visual indent # E128 continuation line under-indented for visual indent # E129 visually indented line with same indent as next logical line -# E203 whitespace before ':' -# E211 whitespace before '(' # E225 missing whitespace around operator # E226 missing whitespace around arithmetic operator -# E228 missing whitespace around modulo operator # E231 missing whitespace after ':' # E241 multiple spaces after # E261 at least two spaces before inline comment # E265 block comment should start with '# ' -# E251 unexpected spaces around keyword / parameter equals -# E302 expected 2 blank lines, found 1 -# E303 too many blank lines # E501 line too long # E712 comparison to bool should be reworded -ignore = E101,E116,E121,E123,E122,E124,E126,E127,E128,E129,E203,E211,E225,E226,E228,E231,E241,E251,E261,E265,E302,E303,E501,E712 +ignore = E116,E121,E122,E123,E124,E126,E127,E128,E129,E225,E226,E231,E241,E261,E265,E501,E712 [testenv:pep8] usedevelop = False