From c9974b9269e5e9943c7b920d9a0569dc80ddebb8 Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Fri, 16 Jan 2015 23:41:16 +0000 Subject: [PATCH] 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 --- .pylintrc | 1 - neutron/agent/linux/keepalived.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.pylintrc b/.pylintrc index e54a281e1f2..ad9c8211bc8 100644 --- a/.pylintrc +++ b/.pylintrc @@ -50,7 +50,6 @@ disable= signature-differs, star-args, super-init-not-called, - unbalanced-tuple-unpacking, unnecessary-lambda, unnecessary-pass, unpacking-non-sequence, diff --git a/neutron/agent/linux/keepalived.py b/neutron/agent/linux/keepalived.py index 596ee6e0240..bbeb3fe3279 100644 --- a/neutron/agent/linux/keepalived.py +++ b/neutron/agent/linux/keepalived.py @@ -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',