Replace ' with " in rally/*.py
Change-Id: I6555a3ed1364c21fa4931909760307bf2fb4b85e Partial-Bug: 1405884
This commit is contained in:
parent
dabfdce96f
commit
a25069bc93
22
rally/api.py
22
rally/api.py
@ -46,13 +46,13 @@ def create_deploy(config, name):
|
|||||||
LOG.exception(e)
|
LOG.exception(e)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
deployer = deploy.EngineFactory.get_engine(deployment['config']['type'],
|
deployer = deploy.EngineFactory.get_engine(deployment["config"]["type"],
|
||||||
deployment)
|
deployment)
|
||||||
try:
|
try:
|
||||||
deployer.validate()
|
deployer.validate()
|
||||||
except jsonschema.ValidationError:
|
except jsonschema.ValidationError:
|
||||||
LOG.error(_('Deployment %(uuid)s: Schema validation error.') %
|
LOG.error(_("Deployment %(uuid)s: Schema validation error.") %
|
||||||
{'uuid': deployment['uuid']})
|
{"uuid": deployment["uuid"]})
|
||||||
deployment.update_status(consts.DeployStatus.DEPLOY_FAILED)
|
deployment.update_status(consts.DeployStatus.DEPLOY_FAILED)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -72,10 +72,10 @@ def destroy_deploy(deployment):
|
|||||||
# TODO(akscram): Check that the deployment have got a status that
|
# TODO(akscram): Check that the deployment have got a status that
|
||||||
# is equal to "*->finished" or "deploy->inconsistent".
|
# is equal to "*->finished" or "deploy->inconsistent".
|
||||||
deployment = objects.Deployment.get(deployment)
|
deployment = objects.Deployment.get(deployment)
|
||||||
deployer = deploy.EngineFactory.get_engine(deployment['config']['type'],
|
deployer = deploy.EngineFactory.get_engine(deployment["config"]["type"],
|
||||||
deployment)
|
deployment)
|
||||||
|
|
||||||
tempest.Tempest(deployment['uuid']).uninstall()
|
tempest.Tempest(deployment["uuid"]).uninstall()
|
||||||
with deployer:
|
with deployer:
|
||||||
deployer.make_cleanup()
|
deployer.make_cleanup()
|
||||||
deployment.delete()
|
deployment.delete()
|
||||||
@ -87,7 +87,7 @@ def recreate_deploy(deployment):
|
|||||||
:param deployment: UUID or name of the deployment
|
:param deployment: UUID or name of the deployment
|
||||||
"""
|
"""
|
||||||
deployment = objects.Deployment.get(deployment)
|
deployment = objects.Deployment.get(deployment)
|
||||||
deployer = deploy.EngineFactory.get_engine(deployment['config']['type'],
|
deployer = deploy.EngineFactory.get_engine(deployment["config"]["type"],
|
||||||
deployment)
|
deployment)
|
||||||
with deployer:
|
with deployer:
|
||||||
deployer.make_cleanup()
|
deployer.make_cleanup()
|
||||||
@ -135,7 +135,7 @@ def create_task(deployment, tag):
|
|||||||
:param tag: tag for this task
|
:param tag: tag for this task
|
||||||
"""
|
"""
|
||||||
|
|
||||||
deployment_uuid = objects.Deployment.get(deployment)['uuid']
|
deployment_uuid = objects.Deployment.get(deployment)["uuid"]
|
||||||
return objects.Task(deployment_uuid=deployment_uuid, tag=tag)
|
return objects.Task(deployment_uuid=deployment_uuid, tag=tag)
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ def task_validate(deployment, config):
|
|||||||
:param config: a dict with a task configuration
|
:param config: a dict with a task configuration
|
||||||
"""
|
"""
|
||||||
deployment = objects.Deployment.get(deployment)
|
deployment = objects.Deployment.get(deployment)
|
||||||
task = objects.Task(deployment_uuid=deployment['uuid'])
|
task = objects.Task(deployment_uuid=deployment["uuid"])
|
||||||
benchmark_engine = engine.BenchmarkEngine(
|
benchmark_engine = engine.BenchmarkEngine(
|
||||||
config, task, admin=deployment["admin"], users=deployment["users"])
|
config, task, admin=deployment["admin"], users=deployment["users"])
|
||||||
benchmark_engine.validate()
|
benchmark_engine.validate()
|
||||||
@ -162,9 +162,9 @@ def start_task(deployment, config, task=None):
|
|||||||
:param config: a dict with a task configuration
|
:param config: a dict with a task configuration
|
||||||
"""
|
"""
|
||||||
deployment = objects.Deployment.get(deployment)
|
deployment = objects.Deployment.get(deployment)
|
||||||
task = task or objects.Task(deployment_uuid=deployment['uuid'])
|
task = task or objects.Task(deployment_uuid=deployment["uuid"])
|
||||||
LOG.info("Benchmark Task %s on Deployment %s" % (task['uuid'],
|
LOG.info("Benchmark Task %s on Deployment %s" % (task["uuid"],
|
||||||
deployment['uuid']))
|
deployment["uuid"]))
|
||||||
benchmark_engine = engine.BenchmarkEngine(
|
benchmark_engine = engine.BenchmarkEngine(
|
||||||
config, task, admin=deployment["admin"], users=deployment["users"])
|
config, task, admin=deployment["admin"], users=deployment["users"])
|
||||||
|
|
||||||
|
@ -53,17 +53,17 @@ class _TaskStatus(utils.ImmutableMixin, utils.EnumMixin):
|
|||||||
|
|
||||||
|
|
||||||
class _DeployStatus(utils.ImmutableMixin, utils.EnumMixin):
|
class _DeployStatus(utils.ImmutableMixin, utils.EnumMixin):
|
||||||
DEPLOY_INIT = 'deploy->init'
|
DEPLOY_INIT = "deploy->init"
|
||||||
DEPLOY_STARTED = 'deploy->started'
|
DEPLOY_STARTED = "deploy->started"
|
||||||
DEPLOY_SUBDEPLOY = 'deploy->subdeploy'
|
DEPLOY_SUBDEPLOY = "deploy->subdeploy"
|
||||||
DEPLOY_FINISHED = 'deploy->finished'
|
DEPLOY_FINISHED = "deploy->finished"
|
||||||
DEPLOY_FAILED = 'deploy->failed'
|
DEPLOY_FAILED = "deploy->failed"
|
||||||
|
|
||||||
DEPLOY_INCONSISTENT = 'deploy->inconsistent'
|
DEPLOY_INCONSISTENT = "deploy->inconsistent"
|
||||||
|
|
||||||
CLEANUP_STARTED = 'cleanup->started'
|
CLEANUP_STARTED = "cleanup->started"
|
||||||
CLEANUP_FINISHED = 'cleanup->finished'
|
CLEANUP_FINISHED = "cleanup->finished"
|
||||||
CLEANUP_FAILED = 'cleanup->failed'
|
CLEANUP_FAILED = "cleanup->failed"
|
||||||
|
|
||||||
|
|
||||||
class _EndpointPermission(utils.ImmutableMixin, utils.EnumMixin):
|
class _EndpointPermission(utils.ImmutableMixin, utils.EnumMixin):
|
||||||
|
@ -24,9 +24,9 @@ from rally.common import log as logging
|
|||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
exc_log_opts = [
|
exc_log_opts = [
|
||||||
cfg.BoolOpt('fatal_exception_format_errors',
|
cfg.BoolOpt("fatal_exception_format_errors",
|
||||||
default=False,
|
default=False,
|
||||||
help='make exception message format errors fatal'),
|
help="make exception message format errors fatal"),
|
||||||
]
|
]
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
@ -37,7 +37,7 @@ class RallyException(Exception):
|
|||||||
"""Base Rally Exception
|
"""Base Rally Exception
|
||||||
|
|
||||||
To correctly use this class, inherit from it and define
|
To correctly use this class, inherit from it and define
|
||||||
a 'msg_fmt' property. That msg_fmt will get printf'd
|
a "msg_fmt" property. That msg_fmt will get printf'd
|
||||||
with the keyword arguments provided to the constructor.
|
with the keyword arguments provided to the constructor.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -73,7 +73,7 @@ class RallyException(Exception):
|
|||||||
super(RallyException, self).__init__(message)
|
super(RallyException, self).__init__(message)
|
||||||
|
|
||||||
def format_message(self):
|
def format_message(self):
|
||||||
if self.__class__.__name__.endswith('_Remote'):
|
if self.__class__.__name__.endswith("_Remote"):
|
||||||
return self.args[0]
|
return self.args[0]
|
||||||
else:
|
else:
|
||||||
return unicode(self)
|
return unicode(self)
|
||||||
|
@ -54,9 +54,9 @@ def cached(func):
|
|||||||
"""Cache client handles."""
|
"""Cache client handles."""
|
||||||
|
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
key = '{0}{1}{2}'.format(func.__name__,
|
key = "{0}{1}{2}".format(func.__name__,
|
||||||
str(args) if args else '',
|
str(args) if args else "",
|
||||||
str(kwargs) if kwargs else '')
|
str(kwargs) if kwargs else "")
|
||||||
|
|
||||||
if key in self.cache:
|
if key in self.cache:
|
||||||
return self.cache[key]
|
return self.cache[key]
|
||||||
@ -69,13 +69,13 @@ def cached(func):
|
|||||||
def create_keystone_client(args):
|
def create_keystone_client(args):
|
||||||
discover = keystone_discover.Discover(**args)
|
discover = keystone_discover.Discover(**args)
|
||||||
for version_data in discover.version_data():
|
for version_data in discover.version_data():
|
||||||
version = version_data['version']
|
version = version_data["version"]
|
||||||
if version[0] <= 2:
|
if version[0] <= 2:
|
||||||
return keystone_v2.Client(**args)
|
return keystone_v2.Client(**args)
|
||||||
elif version[0] == 3:
|
elif version[0] == 3:
|
||||||
return keystone_v3.Client(**args)
|
return keystone_v3.Client(**args)
|
||||||
raise exceptions.RallyException(
|
raise exceptions.RallyException(
|
||||||
'Failed to discover keystone version for url %(auth_url)s.', **args)
|
"Failed to discover keystone version for url %(auth_url)s.", **args)
|
||||||
|
|
||||||
|
|
||||||
class Clients(object):
|
class Clients(object):
|
||||||
@ -111,7 +111,7 @@ class Clients(object):
|
|||||||
try:
|
try:
|
||||||
# Ensure that user is admin
|
# Ensure that user is admin
|
||||||
client = self.keystone()
|
client = self.keystone()
|
||||||
if 'admin' not in [role.lower() for role in
|
if "admin" not in [role.lower() for role in
|
||||||
client.auth_ref.role_names]:
|
client.auth_ref.role_names]:
|
||||||
raise exceptions.InvalidAdminException(
|
raise exceptions.InvalidAdminException(
|
||||||
username=self.endpoint.username)
|
username=self.endpoint.username)
|
||||||
@ -123,11 +123,11 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def nova(self, version='2'):
|
def nova(self, version="2"):
|
||||||
"""Return nova client."""
|
"""Return nova client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
compute_api_url = kc.service_catalog.url_for(
|
compute_api_url = kc.service_catalog.url_for(
|
||||||
service_type='compute',
|
service_type="compute",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
client = nova.Client(version,
|
client = nova.Client(version,
|
||||||
@ -140,11 +140,11 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def neutron(self, version='2.0'):
|
def neutron(self, version="2.0"):
|
||||||
"""Return neutron client."""
|
"""Return neutron client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
network_api_url = kc.service_catalog.url_for(
|
network_api_url = kc.service_catalog.url_for(
|
||||||
service_type='network',
|
service_type="network",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
client = neutron.Client(version,
|
client = neutron.Client(version,
|
||||||
@ -156,11 +156,11 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def glance(self, version='1'):
|
def glance(self, version="1"):
|
||||||
"""Return glance client."""
|
"""Return glance client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
image_api_url = kc.service_catalog.url_for(
|
image_api_url = kc.service_catalog.url_for(
|
||||||
service_type='image',
|
service_type="image",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
client = glance.Client(version,
|
client = glance.Client(version,
|
||||||
@ -172,11 +172,11 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def heat(self, version='1'):
|
def heat(self, version="1"):
|
||||||
"""Return heat client."""
|
"""Return heat client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
orchestration_api_url = kc.service_catalog.url_for(
|
orchestration_api_url = kc.service_catalog.url_for(
|
||||||
service_type='orchestration',
|
service_type="orchestration",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
client = heat.Client(version,
|
client = heat.Client(version,
|
||||||
@ -188,7 +188,7 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def cinder(self, version='1'):
|
def cinder(self, version="1"):
|
||||||
"""Return cinder client."""
|
"""Return cinder client."""
|
||||||
client = cinder.Client(version, None, None,
|
client = cinder.Client(version, None, None,
|
||||||
http_log_debug=logging.is_debug(),
|
http_log_debug=logging.is_debug(),
|
||||||
@ -197,7 +197,7 @@ class Clients(object):
|
|||||||
cacert=CONF.https_cacert)
|
cacert=CONF.https_cacert)
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
volume_api_url = kc.service_catalog.url_for(
|
volume_api_url = kc.service_catalog.url_for(
|
||||||
service_type='volume',
|
service_type="volume",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
client.client.management_url = volume_api_url
|
client.client.management_url = volume_api_url
|
||||||
@ -205,15 +205,15 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def ceilometer(self, version='2'):
|
def ceilometer(self, version="2"):
|
||||||
"""Return ceilometer client."""
|
"""Return ceilometer client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
metering_api_url = kc.service_catalog.url_for(
|
metering_api_url = kc.service_catalog.url_for(
|
||||||
service_type='metering',
|
service_type="metering",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
auth_token = kc.auth_token
|
auth_token = kc.auth_token
|
||||||
if not hasattr(auth_token, '__call__'):
|
if not hasattr(auth_token, "__call__"):
|
||||||
# python-ceilometerclient requires auth_token to be a callable
|
# python-ceilometerclient requires auth_token to be a callable
|
||||||
auth_token = lambda: kc.auth_token
|
auth_token = lambda: kc.auth_token
|
||||||
|
|
||||||
@ -226,11 +226,11 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def ironic(self, version='1.0'):
|
def ironic(self, version="1.0"):
|
||||||
"""Return Ironic client."""
|
"""Return Ironic client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
baremetal_api_url = kc.service_catalog.url_for(
|
baremetal_api_url = kc.service_catalog.url_for(
|
||||||
service_type='baremetal',
|
service_type="baremetal",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
client = ironic.get_client(version,
|
client = ironic.get_client(version,
|
||||||
@ -242,7 +242,7 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def sahara(self, version='1.1'):
|
def sahara(self, version="1.1"):
|
||||||
"""Return Sahara client."""
|
"""Return Sahara client."""
|
||||||
client = sahara.Client(version,
|
client = sahara.Client(version,
|
||||||
username=self.endpoint.username,
|
username=self.endpoint.username,
|
||||||
@ -257,16 +257,16 @@ class Clients(object):
|
|||||||
"""Return Zaqar client."""
|
"""Return Zaqar client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
messaging_api_url = kc.service_catalog.url_for(
|
messaging_api_url = kc.service_catalog.url_for(
|
||||||
service_type='messaging',
|
service_type="messaging",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
conf = {'auth_opts': {'backend': 'keystone', 'options': {
|
conf = {"auth_opts": {"backend": "keystone", "options": {
|
||||||
'os_username': self.endpoint.username,
|
"os_username": self.endpoint.username,
|
||||||
'os_password': self.endpoint.password,
|
"os_password": self.endpoint.password,
|
||||||
'os_project_name': self.endpoint.tenant_name,
|
"os_project_name": self.endpoint.tenant_name,
|
||||||
'os_project_id': kc.auth_tenant_id,
|
"os_project_id": kc.auth_tenant_id,
|
||||||
'os_auth_url': self.endpoint.auth_url,
|
"os_auth_url": self.endpoint.auth_url,
|
||||||
'insecure': CONF.https_insecure,
|
"insecure": CONF.https_insecure,
|
||||||
}}}
|
}}}
|
||||||
client = zaqar.Client(url=messaging_api_url,
|
client = zaqar.Client(url=messaging_api_url,
|
||||||
version=version,
|
version=version,
|
||||||
@ -278,7 +278,7 @@ class Clients(object):
|
|||||||
"""Return designate client."""
|
"""Return designate client."""
|
||||||
kc = self.keystone()
|
kc = self.keystone()
|
||||||
dns_api_url = kc.service_catalog.url_for(
|
dns_api_url = kc.service_catalog.url_for(
|
||||||
service_type='dns',
|
service_type="dns",
|
||||||
endpoint_type=self.endpoint.endpoint_type,
|
endpoint_type=self.endpoint.endpoint_type,
|
||||||
region_name=self.endpoint.region_name)
|
region_name=self.endpoint.region_name)
|
||||||
client = designate.Client(
|
client = designate.Client(
|
||||||
@ -288,7 +288,7 @@ class Clients(object):
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
@cached
|
@cached
|
||||||
def trove(self, version='1.0'):
|
def trove(self, version="1.0"):
|
||||||
"""Returns trove client."""
|
"""Returns trove client."""
|
||||||
client = trove.Client(version,
|
client = trove.Client(version,
|
||||||
username=self.endpoint.username,
|
username=self.endpoint.username,
|
||||||
|
Loading…
Reference in New Issue
Block a user