Fix bug 659: Don't use static member variables 99/7399/2
authorAdam Israel <adam.israel@canonical.com>
Tue, 9 Apr 2019 20:07:53 +0000 (16:07 -0400)
committerAdam Israel <adam.israel@canonical.com>
Tue, 9 Apr 2019 20:24:20 +0000 (16:24 -0400)
This fixes bug 659, where static member variables were used by the
VCAMonitor, causing unexpected behaviour when deploying and destroying a
network service multiple times.

Change-Id: Icc5e4da62aeb11e4c89ba3cf5f148c6959acf7e3
Signed-off-by: Adam Israel <adam.israel@canonical.com>
n2vc/vnf.py

index 1bdfe2f..a486f27 100644 (file)
@@ -57,13 +57,12 @@ logging.getLogger('juju.machine').setLevel(logging.WARN)
 class VCAMonitor(ModelObserver):
     """Monitor state changes within the Juju Model."""
     log = None
 class VCAMonitor(ModelObserver):
     """Monitor state changes within the Juju Model."""
     log = None
-    ns_name = None
-    applications = {}
 
     def __init__(self, ns_name):
         self.log = logging.getLogger(__name__)
 
         self.ns_name = ns_name
 
     def __init__(self, ns_name):
         self.log = logging.getLogger(__name__)
 
         self.ns_name = ns_name
+        self.applications = {}
 
     def AddApplication(self, application_name, callback, *callback_args):
         if application_name not in self.applications:
 
     def AddApplication(self, application_name, callback, *callback_args):
         if application_name not in self.applications: