Fix pylint unbalanced-tuple-unpacking warning
Pylint last version(1.4.1), at least, reports an unbalanced-tuple-unpacking warning[1] in keepalived[2] module because self.authentication is defined as an empty tuple in __init__ method and unpacked in build_config method as if it was a 2-tuple. self.authentication references an empty tuple (defined in __init__ method) or a 2-tuple (updated in set_authentication method). Such warning is a false positive because the unpacking is only performed if self.authentication is not evaluated to false which only appends if self.authentication is a 2-tuple. Defining self.authentication as None in __init__ avoids such warning without disabling unbalanced-tuple-unpacking warning check. [1] W:252,12: Possible unbalanced tuple unpacking with sequence defined at line 153: left side has 2 label(s), right side has 0 value(s) (unbalanced-tuple-unpacking) [2] neutron.agent.linux.keepalived Change-Id: Ifcdf08e574ef44a65c6d121323cbe31d9af2f921 Closes-Bug: #1411865
This commit is contained in:
parent
e749d3c4ba
commit
c9974b9269
@ -50,7 +50,6 @@ disable=
|
||||
signature-differs,
|
||||
star-args,
|
||||
super-init-not-called,
|
||||
unbalanced-tuple-unpacking,
|
||||
unnecessary-lambda,
|
||||
unnecessary-pass,
|
||||
unpacking-non-sequence,
|
||||
|
@ -150,7 +150,7 @@ class KeepalivedInstance(object):
|
||||
self.track_interfaces = []
|
||||
self.vips = []
|
||||
self.virtual_routes = []
|
||||
self.authentication = tuple()
|
||||
self.authentication = None
|
||||
metadata_cidr = '169.254.169.254/32'
|
||||
self.primary_vip_range = get_free_range(
|
||||
parent_range='169.254.0.0/16',
|
||||
|
Loading…
Reference in New Issue
Block a user