F841 local variable 'X' is assigned to but never used
un-suppress the flake8 error check for F841, and update the code to fix that error Test Plan: PASS: system drbdsync-modify --util 41 Story: 2008943 Task: 44099 Signed-off-by: Jia Hu <jia.hu@windriver.com> Change-Id: I8654b23489e9574ee935c66df0054bdc589a4cdb
This commit is contained in:
parent
42b0b45122
commit
3c838b033e
@ -74,7 +74,7 @@ def _wrapping_formatter_callback_decorator(subparser, command, callback):
|
||||
try:
|
||||
subparser.add_argument('--nowrap', action='store_true',
|
||||
help='No wordwrapping of output')
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# exception happens when nowrap option already configured
|
||||
# for command - so get out with callback undecorated
|
||||
return callback
|
||||
|
@ -199,7 +199,7 @@ class CgtsclientException(Exception):
|
||||
try:
|
||||
message = self.message % kwargs # pylint: disable=exception-message-attribute
|
||||
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
# kwargs doesn't match a variable in the message
|
||||
# at least get the core message out if something happened
|
||||
message = self.message # pylint: disable=exception-message-attribute
|
||||
|
@ -346,7 +346,7 @@ def main():
|
||||
print(('caught: %r, aborting' % (e)), file=sys.stderr)
|
||||
sys.exit(0)
|
||||
|
||||
except IOError as e:
|
||||
except IOError:
|
||||
sys.exit(0)
|
||||
|
||||
except Exception as e:
|
||||
|
@ -46,7 +46,7 @@ def do_drbdsync_show(cc, args):
|
||||
_print_drbdsync_show(drbdconfigs[0])
|
||||
print('')
|
||||
|
||||
ihosts = cc.ihost.list_personality(personality=CONTROLLER)
|
||||
ihosts = cc.ihost.list_personality(CONTROLLER)
|
||||
_print_controller_config_show(ihosts)
|
||||
|
||||
|
||||
@ -84,9 +84,8 @@ def do_drbdsync_modify(cc, args):
|
||||
% pa['path'][1:])
|
||||
|
||||
# Prevent update if controllers are mid-configuration
|
||||
personality = 'controller'
|
||||
is_config = False
|
||||
ihosts = cc.ihost.list_personality(personality=CONTROLLER)
|
||||
ihosts = cc.ihost.list_personality(CONTROLLER)
|
||||
for ihost in ihosts:
|
||||
if ihost.config_target and ihost.config_applied != ihost.config_target:
|
||||
is_config = True
|
||||
@ -108,7 +107,7 @@ def do_drbdsync_modify(cc, args):
|
||||
do_wait = True
|
||||
LOOP_MAX = int(configuration_timeout // wait_interval)
|
||||
for x in range(0, LOOP_MAX):
|
||||
ihosts = cc.ihost.list_personality(personality=CONTROLLER)
|
||||
ihosts = cc.ihost.list_personality(CONTROLLER)
|
||||
do_wait = False
|
||||
hosts = []
|
||||
for ihost in ihosts:
|
||||
|
@ -49,7 +49,6 @@ class HostFsManager(base.Manager):
|
||||
|
||||
def create(self, **kwargs):
|
||||
path = '/v1/host_fs'
|
||||
valid_list = []
|
||||
new = {}
|
||||
for (key, value) in kwargs.items():
|
||||
if key in CREATION_ATTRIBUTES:
|
||||
|
@ -138,7 +138,7 @@ def do_host_disk_wipe(cc, args):
|
||||
patch.append({'op': 'replace', 'path': '/' + k, 'value': v})
|
||||
|
||||
try:
|
||||
updated_idisk = cc.idisk.update(idisk.uuid, patch)
|
||||
cc.idisk.update(idisk.uuid, patch)
|
||||
except exc.HTTPNotFound:
|
||||
raise exc.CommandError(
|
||||
"ERROR: Failed to wipe and GPT format disk %s "
|
||||
|
@ -182,7 +182,7 @@ def do_host_sensorgroup_relearn(cc, args):
|
||||
|
||||
ihost = ihost_utils._find_ihost(cc, args.hostnameorid)
|
||||
|
||||
isensorgroups = cc.isensorgroup.relearn(ihost.uuid)
|
||||
cc.isensorgroup.relearn(ihost.uuid)
|
||||
|
||||
print("%s sensor model and any related alarm assertions are being "
|
||||
"deleted." % (args.hostnameorid))
|
||||
|
@ -52,7 +52,6 @@ def do_ptp_modify(cc, args):
|
||||
|
||||
ptps = cc.ptp.list()
|
||||
ptp = ptps[0]
|
||||
op = "replace"
|
||||
|
||||
attributes = []
|
||||
|
||||
|
@ -77,7 +77,7 @@ def do_service_enable(cc, args):
|
||||
patch = utils.dict_to_patch(values)
|
||||
|
||||
try:
|
||||
response = cc.sm_service.update(args.service, patch)
|
||||
cc.sm_service.update(args.service, patch)
|
||||
except exc.HTTPNotFound:
|
||||
raise exc.CommandError('service not recognized: %s' % args.service)
|
||||
except exc.Forbidden:
|
||||
@ -91,7 +91,7 @@ def do_service_disable(cc, args):
|
||||
values = {'enabled': False}
|
||||
patch = utils.dict_to_patch(values)
|
||||
try:
|
||||
response = cc.sm_service.update(args.service, patch)
|
||||
cc.sm_service.update(args.service, patch)
|
||||
except exc.HTTPNotFound:
|
||||
raise exc.CommandError('service not recognized: %s' % args.service)
|
||||
except exc.Forbidden:
|
||||
|
@ -111,12 +111,10 @@ max-complexity=25
|
||||
# E501 line too long
|
||||
# E731 do not assign a lambda expression, use a def
|
||||
# -F- codes are errors
|
||||
# F841 local variable 'X' is assigned to but never used
|
||||
ignore = H102,H104,H105,H238,H404,H405,
|
||||
B004,B005,B006,B009,B010,
|
||||
W503,W504,W605,
|
||||
E501,E731,
|
||||
F841
|
||||
E501,E731
|
||||
|
||||
[testenv:pylint]
|
||||
basepython = python3
|
||||
|
Loading…
Reference in New Issue
Block a user