Use new style classes everywhere
Old style classes has been deprecated and should not be used anymore https://docs.python.org/2/reference/datamodel.html#new-style-and-classic-classes Change-Id: I8f85f5a63af7c6500d6efcde5efe8a1fd1456ff0 Closes-Bug: #1378021
This commit is contained in:
parent
4d3d9cfa9f
commit
58f8fd6d96
@ -25,7 +25,7 @@ import sahara.openstack.commons as commons
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class AuthValidator:
|
class AuthValidator(object):
|
||||||
"""Handles token auth results and tenants."""
|
"""Handles token auth results and tenants."""
|
||||||
|
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
|
@ -363,7 +363,7 @@ class AmbariPlugin(p.ProvisioningPluginBase):
|
|||||||
server.configure_topology(topology_str)
|
server.configure_topology(topology_str)
|
||||||
|
|
||||||
|
|
||||||
class AmbariInfo():
|
class AmbariInfo(object):
|
||||||
def __init__(self, host, port, user, password):
|
def __init__(self, host, port, user, password):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
|
@ -24,7 +24,7 @@ from sahara.plugins.hdp.versions import versionhandlerfactory as vhf
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ClusterSpec():
|
class ClusterSpec(object):
|
||||||
def __init__(self, config, version='1.3.2'):
|
def __init__(self, config, version='1.3.2'):
|
||||||
self._config_template = config
|
self._config_template = config
|
||||||
self.services = []
|
self.services = []
|
||||||
@ -215,14 +215,14 @@ class ClusterSpec():
|
|||||||
config_map[user_input.config.name] = user_input.value
|
config_map[user_input.config.name] = user_input.value
|
||||||
|
|
||||||
|
|
||||||
class Component():
|
class Component(object):
|
||||||
def __init__(self, name, component_type, cardinality):
|
def __init__(self, name, component_type, cardinality):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.type = component_type
|
self.type = component_type
|
||||||
self.cardinality = cardinality
|
self.cardinality = cardinality
|
||||||
|
|
||||||
|
|
||||||
class NodeGroup():
|
class NodeGroup(object):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.id = None
|
self.id = None
|
||||||
self.name = name
|
self.name = name
|
||||||
@ -240,14 +240,14 @@ class NodeGroup():
|
|||||||
return self.ng_storage_paths
|
return self.ng_storage_paths
|
||||||
|
|
||||||
|
|
||||||
class User():
|
class User(object):
|
||||||
def __init__(self, name, password, groups):
|
def __init__(self, name, password, groups):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.password = password
|
self.password = password
|
||||||
self.groups = groups
|
self.groups = groups
|
||||||
|
|
||||||
|
|
||||||
class Instance():
|
class Instance(object):
|
||||||
def __init__(self, sahara_instance):
|
def __init__(self, sahara_instance):
|
||||||
self.inst_fqdn = sahara_instance.fqdn()
|
self.inst_fqdn = sahara_instance.fqdn()
|
||||||
self.management_ip = sahara_instance.management_ip
|
self.management_ip = sahara_instance.management_ip
|
||||||
@ -267,7 +267,7 @@ class Instance():
|
|||||||
return self.fqdn() == other.fqdn()
|
return self.fqdn() == other.fqdn()
|
||||||
|
|
||||||
|
|
||||||
class NormalizedClusterConfig():
|
class NormalizedClusterConfig(object):
|
||||||
def __init__(self, cluster_spec):
|
def __init__(self, cluster_spec):
|
||||||
self.hadoop_version = cluster_spec.version
|
self.hadoop_version = cluster_spec.version
|
||||||
self.cluster_configs = []
|
self.cluster_configs = []
|
||||||
@ -319,7 +319,7 @@ class NormalizedClusterConfig():
|
|||||||
{"property": prop, "value": value})
|
{"property": prop, "value": value})
|
||||||
|
|
||||||
|
|
||||||
class NormalizedConfig():
|
class NormalizedConfig(object):
|
||||||
def __init__(self, name, config_type, default_value, target, scope):
|
def __init__(self, name, config_type, default_value, target, scope):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.description = None
|
self.description = None
|
||||||
@ -330,13 +330,13 @@ class NormalizedConfig():
|
|||||||
self.scope = scope
|
self.scope = scope
|
||||||
|
|
||||||
|
|
||||||
class NormalizedConfigEntry():
|
class NormalizedConfigEntry(object):
|
||||||
def __init__(self, config, value):
|
def __init__(self, config, value):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
|
|
||||||
class NormalizedNodeGroup():
|
class NormalizedNodeGroup(object):
|
||||||
def __init__(self, node_group):
|
def __init__(self, node_group):
|
||||||
self.name = node_group.name
|
self.name = node_group.name
|
||||||
self.node_processes = node_group.components
|
self.node_processes = node_group.components
|
||||||
|
@ -18,7 +18,7 @@ from sahara.i18n import _
|
|||||||
from sahara.plugins import provisioning as p
|
from sahara.plugins import provisioning as p
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationProvider:
|
class ConfigurationProvider(object):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.config_mapper = {}
|
self.config_mapper = {}
|
||||||
|
@ -37,7 +37,7 @@ HADOOP_SWIFT_LOCAL_RPM = ('/opt/hdp-local-repos/hadoop-swift/'
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class HadoopServer:
|
class HadoopServer(object):
|
||||||
_master_ip = None
|
_master_ip = None
|
||||||
|
|
||||||
def __init__(self, instance, node_group, ambari_rpm=None):
|
def __init__(self, instance, node_group, ambari_rpm=None):
|
||||||
@ -211,7 +211,7 @@ class HadoopServer:
|
|||||||
return self._is_component_available('GANGLIA_MONITOR')
|
return self._is_component_available('GANGLIA_MONITOR')
|
||||||
|
|
||||||
|
|
||||||
class DefaultPromptMatcher():
|
class DefaultPromptMatcher(object):
|
||||||
prompt_pattern = re.compile('(.*\()(.)(\)\?\s*$)', re.DOTALL)
|
prompt_pattern = re.compile('(.*\()(.)(\)\?\s*$)', re.DOTALL)
|
||||||
|
|
||||||
def __init__(self, terminal_token):
|
def __init__(self, terminal_token):
|
||||||
|
@ -19,7 +19,7 @@ import six
|
|||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class AbstractVersionHandler():
|
class AbstractVersionHandler(object):
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_config_items(self):
|
def get_config_items(self):
|
||||||
|
@ -126,7 +126,7 @@ class VersionHandler(avm.AbstractVersionHandler):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class AmbariClient():
|
class AmbariClient(object):
|
||||||
|
|
||||||
def __init__(self, handler):
|
def __init__(self, handler):
|
||||||
# add an argument for neutron discovery
|
# add an argument for neutron discovery
|
||||||
|
@ -114,7 +114,7 @@ class VersionHandler(avm.AbstractVersionHandler):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class AmbariClient():
|
class AmbariClient(object):
|
||||||
|
|
||||||
def __init__(self, handler):
|
def __init__(self, handler):
|
||||||
# add an argument for neutron discovery
|
# add an argument for neutron discovery
|
||||||
|
@ -18,7 +18,7 @@ import os
|
|||||||
from sahara.utils import general
|
from sahara.utils import general
|
||||||
|
|
||||||
|
|
||||||
class VersionHandlerFactory():
|
class VersionHandlerFactory(object):
|
||||||
versions = None
|
versions = None
|
||||||
modules = None
|
modules = None
|
||||||
initialized = False
|
initialized = False
|
||||||
|
@ -19,7 +19,7 @@ import six
|
|||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class AbstractVersionHandler():
|
class AbstractVersionHandler(object):
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_node_processes(self):
|
def get_node_processes(self):
|
||||||
|
@ -19,7 +19,7 @@ import re
|
|||||||
from sahara.utils import general
|
from sahara.utils import general
|
||||||
|
|
||||||
|
|
||||||
class VersionFactory():
|
class VersionFactory(object):
|
||||||
versions = None
|
versions = None
|
||||||
modules = None
|
modules = None
|
||||||
initialized = False
|
initialized = False
|
||||||
|
@ -37,7 +37,7 @@ conductor = c.API
|
|||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class Engine:
|
class Engine(object):
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def create_cluster(self, cluster):
|
def create_cluster(self, cluster):
|
||||||
pass
|
pass
|
||||||
|
@ -616,7 +616,7 @@ def register_config(config, config_group, config_opts):
|
|||||||
|
|
||||||
|
|
||||||
@singleton
|
@singleton
|
||||||
class ITConfig:
|
class ITConfig(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
config = 'itest.conf'
|
config = 'itest.conf'
|
||||||
config_files = []
|
config_files = []
|
||||||
|
@ -19,7 +19,7 @@ from sahara.plugins.hdp import clusterspec as cs
|
|||||||
from sahara import version
|
from sahara import version
|
||||||
|
|
||||||
|
|
||||||
class TestServer:
|
class TestServer(object):
|
||||||
def __init__(self, hostname, role, img, flavor, public_ip, private_ip):
|
def __init__(self, hostname, role, img, flavor, public_ip, private_ip):
|
||||||
self.inst_fqdn = hostname
|
self.inst_fqdn = hostname
|
||||||
self.role = role
|
self.role = role
|
||||||
@ -51,7 +51,7 @@ def create_clusterspec(hdp_version='1.3.2'):
|
|||||||
return cs.ClusterSpec(cluster_config_file, version=hdp_version)
|
return cs.ClusterSpec(cluster_config_file, version=hdp_version)
|
||||||
|
|
||||||
|
|
||||||
class InstanceInfo:
|
class InstanceInfo(object):
|
||||||
def __init__(self, hostname, image, flavor, management_ip, internal_ip):
|
def __init__(self, hostname, image, flavor, management_ip, internal_ip):
|
||||||
self.image = image
|
self.image = image
|
||||||
self.flavor = flavor
|
self.flavor = flavor
|
||||||
@ -59,7 +59,7 @@ class InstanceInfo:
|
|||||||
self.internal_ip = internal_ip
|
self.internal_ip = internal_ip
|
||||||
|
|
||||||
|
|
||||||
class TestCluster():
|
class TestCluster(object):
|
||||||
def __init__(self, node_groups):
|
def __init__(self, node_groups):
|
||||||
self.plugin_name = 'hdp'
|
self.plugin_name = 'hdp'
|
||||||
self.hadoop_version = None
|
self.hadoop_version = None
|
||||||
@ -68,7 +68,7 @@ class TestCluster():
|
|||||||
self.default_image_id = '11111'
|
self.default_image_id = '11111'
|
||||||
|
|
||||||
|
|
||||||
class TestNodeGroup:
|
class TestNodeGroup(object):
|
||||||
def __init__(self, name, instances, node_processes, count=1):
|
def __init__(self, name, instances, node_processes, count=1):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.instances = instances
|
self.instances = instances
|
||||||
@ -84,14 +84,14 @@ class TestNodeGroup:
|
|||||||
return self.ng_storage_paths
|
return self.ng_storage_paths
|
||||||
|
|
||||||
|
|
||||||
class TestUserInputConfig:
|
class TestUserInputConfig(object):
|
||||||
def __init__(self, tag, target, name):
|
def __init__(self, tag, target, name):
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
self.applicable_target = target
|
self.applicable_target = target
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
|
|
||||||
class TestRequest:
|
class TestRequest(object):
|
||||||
def put(self, url, data=None, auth=None, headers=None):
|
def put(self, url, data=None, auth=None, headers=None):
|
||||||
self.url = url
|
self.url = url
|
||||||
self.data = data
|
self.data = data
|
||||||
@ -120,13 +120,13 @@ class TestRequest:
|
|||||||
return TestResult(200)
|
return TestResult(200)
|
||||||
|
|
||||||
|
|
||||||
class TestResult:
|
class TestResult(object):
|
||||||
def __init__(self, status):
|
def __init__(self, status):
|
||||||
self.status_code = status
|
self.status_code = status
|
||||||
self.text = ''
|
self.text = ''
|
||||||
|
|
||||||
|
|
||||||
class TestUserInput:
|
class TestUserInput(object):
|
||||||
def __init__(self, config, value):
|
def __init__(self, config, value):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.value = value
|
self.value = value
|
||||||
|
@ -347,7 +347,7 @@ class AmbariPluginTest(sahara_base.SaharaTestCase):
|
|||||||
return request
|
return request
|
||||||
|
|
||||||
|
|
||||||
class TestHost:
|
class TestHost(object):
|
||||||
def __init__(self, management_ip, role=None):
|
def __init__(self, management_ip, role=None):
|
||||||
self.management_ip = management_ip
|
self.management_ip = management_ip
|
||||||
self.role = role
|
self.role = role
|
||||||
|
@ -1534,7 +1534,7 @@ class ClusterSpecTest(sahara_base.SaharaTestCase):
|
|||||||
self.assertIn('hbase-site', configurations)
|
self.assertIn('hbase-site', configurations)
|
||||||
|
|
||||||
|
|
||||||
class TestNodeGroup:
|
class TestNodeGroup(object):
|
||||||
def __init__(self, name, instances, node_processes, count=1):
|
def __init__(self, name, instances, node_processes, count=1):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.instances = instances
|
self.instances = instances
|
||||||
@ -1548,7 +1548,7 @@ class TestNodeGroup:
|
|||||||
return ['']
|
return ['']
|
||||||
|
|
||||||
|
|
||||||
class TestUserInputConfig:
|
class TestUserInputConfig(object):
|
||||||
def __init__(self, tag, target, name):
|
def __init__(self, tag, target, name):
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
self.applicable_target = target
|
self.applicable_target = target
|
||||||
|
@ -1918,7 +1918,7 @@ class ClusterSpecTestForHDP2(sahara_base.SaharaTestCase):
|
|||||||
self.assertIn('hue-oozie-site', configurations)
|
self.assertIn('hue-oozie-site', configurations)
|
||||||
|
|
||||||
|
|
||||||
class TestNodeGroup:
|
class TestNodeGroup(object):
|
||||||
def __init__(self, name, instances, node_processes, count=1):
|
def __init__(self, name, instances, node_processes, count=1):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.instances = instances
|
self.instances = instances
|
||||||
@ -1932,7 +1932,7 @@ class TestNodeGroup:
|
|||||||
return ['']
|
return ['']
|
||||||
|
|
||||||
|
|
||||||
class TestUserInputConfig:
|
class TestUserInputConfig(object):
|
||||||
def __init__(self, tag, target, name):
|
def __init__(self, tag, target, name):
|
||||||
self.tag = tag
|
self.tag = tag
|
||||||
self.applicable_target = target
|
self.applicable_target = target
|
||||||
|
@ -63,7 +63,7 @@ class VanillaTwoConfigTestCase(base.SaharaTestCase):
|
|||||||
self.assertEqual(res, expected)
|
self.assertEqual(res, expected)
|
||||||
|
|
||||||
|
|
||||||
class FakeNG():
|
class FakeNG(object):
|
||||||
def __init__(self, storage_paths=None):
|
def __init__(self, storage_paths=None):
|
||||||
self.paths = storage_paths
|
self.paths = storage_paths
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from sahara.service import ops
|
|||||||
from sahara.tests.unit import base
|
from sahara.tests.unit import base
|
||||||
|
|
||||||
|
|
||||||
class FakeNodeGroup():
|
class FakeNodeGroup(object):
|
||||||
id = 'id'
|
id = 'id'
|
||||||
count = 2
|
count = 2
|
||||||
instances = [1, 2]
|
instances = [1, 2]
|
||||||
@ -51,7 +51,7 @@ class FakePlugin(mock.Mock):
|
|||||||
TestOPS.SEQUENCE.append('cluster_destroy')
|
TestOPS.SEQUENCE.append('cluster_destroy')
|
||||||
|
|
||||||
|
|
||||||
class FakeINFRA():
|
class FakeINFRA(object):
|
||||||
def create_cluster(self, cluster):
|
def create_cluster(self, cluster):
|
||||||
TestOPS.SEQUENCE.append('create_cluster')
|
TestOPS.SEQUENCE.append('create_cluster')
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class TestAttachVolume(base.SaharaWithDbTestCase):
|
|||||||
@mock.patch('cinderclient.v1.volumes.Volume.detach')
|
@mock.patch('cinderclient.v1.volumes.Volume.detach')
|
||||||
@mock.patch('sahara.utils.openstack.cinder.get_volume')
|
@mock.patch('sahara.utils.openstack.cinder.get_volume')
|
||||||
def test_detach_volumes(self, p_get_volume, p_detach, p_delete, p_cond):
|
def test_detach_volumes(self, p_get_volume, p_detach, p_delete, p_cond):
|
||||||
class Instance:
|
class Instance(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.instance_id = '123454321'
|
self.instance_id = '123454321'
|
||||||
self.volumes = [123]
|
self.volumes = [123]
|
||||||
|
@ -160,7 +160,7 @@ def start_patch(patch_templates=True):
|
|||||||
heat = heat_p.start()
|
heat = heat_p.start()
|
||||||
heat().stacks.list.side_effect = _get_heat_stack_list
|
heat().stacks.list.side_effect = _get_heat_stack_list
|
||||||
|
|
||||||
class Service:
|
class Service(object):
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return 'cinder'
|
return 'cinder'
|
||||||
@ -170,7 +170,7 @@ def start_patch(patch_templates=True):
|
|||||||
|
|
||||||
keystone().services.list.side_effect = _services_list
|
keystone().services.list.side_effect = _services_list
|
||||||
|
|
||||||
class Image:
|
class Image(object):
|
||||||
def __init__(self, name='test'):
|
def __init__(self, name='test'):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ class TestClusterStack(testtools.TestCase):
|
|||||||
h.wait_stack_completion(stack)
|
h.wait_stack_completion(stack)
|
||||||
|
|
||||||
|
|
||||||
class FakeHeatStack():
|
class FakeHeatStack(object):
|
||||||
def __init__(self, stack_status=None, new_status=None, stack_name=None):
|
def __init__(self, stack_status=None, new_status=None, stack_name=None):
|
||||||
self.stack_status = stack_status or ''
|
self.stack_status = stack_status or ''
|
||||||
self.new_status = new_status or ''
|
self.new_status = new_status or ''
|
||||||
|
@ -33,7 +33,7 @@ def _test_get_neutron_client(api_version, *args, **kwargs):
|
|||||||
return FakeNeutronClient()
|
return FakeNeutronClient()
|
||||||
|
|
||||||
|
|
||||||
class FakeNeutronClient():
|
class FakeNeutronClient(object):
|
||||||
def list_routers(self):
|
def list_routers(self):
|
||||||
return {"routers": [{"status": "ACTIVE", "external_gateway_info": {
|
return {"routers": [{"status": "ACTIVE", "external_gateway_info": {
|
||||||
"network_id": "61f95d3f-495e-4409-8c29-0b806283c81e"},
|
"network_id": "61f95d3f-495e-4409-8c29-0b806283c81e"},
|
||||||
|
@ -43,7 +43,7 @@ def client():
|
|||||||
return neutron_cli.Client('2.0', **args)
|
return neutron_cli.Client('2.0', **args)
|
||||||
|
|
||||||
|
|
||||||
class NeutronClientRemoteWrapper():
|
class NeutronClientRemoteWrapper(object):
|
||||||
neutron = None
|
neutron = None
|
||||||
adapters = {}
|
adapters = {}
|
||||||
routers = {}
|
routers = {}
|
||||||
@ -155,7 +155,7 @@ class NeutronHttpAdapter(adapters.HTTPAdapter):
|
|||||||
return NetcatSocket(self.cmd)
|
return NetcatSocket(self.cmd)
|
||||||
|
|
||||||
|
|
||||||
class NetcatSocket:
|
class NetcatSocket(object):
|
||||||
|
|
||||||
def _create_process(self):
|
def _create_process(self):
|
||||||
self.process = e_subprocess.Popen(self.cmd,
|
self.process = e_subprocess.Popen(self.cmd,
|
||||||
|
Loading…
Reference in New Issue
Block a user