fix super() calls, must use explicit class name 05/28305/2
authorRoss Brattain <ross.b.brattain@intel.com>
Wed, 8 Feb 2017 22:42:08 +0000 (14:42 -0800)
committerRoss Brattain <ross.b.brattain@intel.com>
Thu, 9 Feb 2017 21:27:46 +0000 (21:27 +0000)
self.__class__ is not correct.  For Python 2 we have to
explicitly use the class name

see http://stackoverflow.com/questions/4235078/how-to-avoid-infinite-recursion-with-super

Change-Id: I584ca565707b7331c1742fb33c8b524f7b7c9bf9
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
yardstick/benchmark/contexts/dummy.py
yardstick/benchmark/contexts/heat.py
yardstick/benchmark/contexts/model.py
yardstick/benchmark/contexts/node.py
yardstick/benchmark/contexts/standalone.py

index f753003..0edc250 100644 (file)
@@ -22,7 +22,7 @@ class DummyContext(Context):
     __context_type__ = "Dummy"
 
     def __init__(self):
-        super(self.__class__, self).__init__()
+        super(DummyContext, self).__init__()
 
     def init(self, attrs):
         pass
index 0346efc..a97a3e2 100644 (file)
@@ -55,7 +55,7 @@ class HeatContext(Context):
         self.key_filename = ''.join(
             [YARDSTICK_ROOT_PATH, 'yardstick/resources/files/yardstick_key-',
              get_short_key_uuid(self.key_uuid)])
-        super(self.__class__, self).__init__()
+        super(HeatContext, self).__init__()
 
     def init(self, attrs):
         """initializes itself from the supplied arguments"""
index 636abfa..c83a209 100644 (file)
@@ -66,7 +66,7 @@ class Router(Object):
     """Class that represents a router in the logical model"""
 
     def __init__(self, name, network_name, context, external_gateway_info):
-        super(self.__class__, self).__init__(name, context)
+        super(Router, self).__init__(name, context)
 
         self.stack_name = context.name + "-" + network_name + "-" + self.name
         self.stack_if_name = self.stack_name + "-if0"
@@ -78,7 +78,7 @@ class Network(Object):
     list = []
 
     def __init__(self, name, context, attrs):
-        super(self.__class__, self).__init__(name, context)
+        super(Network, self).__init__(name, context)
         self.stack_name = context.name + "-" + self.name
         self.subnet_stack_name = self.stack_name + "-subnet"
         self.subnet_cidr = attrs.get('cidr', '10.0.1.0/24')
@@ -118,7 +118,7 @@ class Server(Object):
     list = []
 
     def __init__(self, name, context, attrs):
-        super(self.__class__, self).__init__(name, context)
+        super(Server, self).__init__(name, context)
         self.stack_name = self.name + "." + context.name
         self.keypair_name = context.keypair_name
         self.secgroup_name = context.secgroup_name
index 9242e27..c7ed3b3 100644 (file)
@@ -32,7 +32,7 @@ class NodeContext(Context):
         self.controllers = []
         self.computes = []
         self.baremetals = []
-        super(self.__class__, self).__init__()
+        super(NodeContext, self).__init__()
 
     def read_config_file(self):
         """Read from config file"""
index c1d963f..eff7009 100644 (file)
@@ -37,7 +37,7 @@ class StandaloneContext(Context):
         self.file_path = None
         self.nodes = []
         self.nfvi_node = []
-        super(self.__class__, self).__init__()
+        super(StandaloneContext, self).__init__()
 
     def read_config_file(self):
         """Read from config file"""