deal with flake8 errors in core code
Change-Id: I8ba64e3a5579427afe52a34e7445b9e6eb65a74c
(cherry picked from commit 01653697e5)
This commit is contained in:
@@ -323,8 +323,11 @@ class Controller(object):
|
||||
req.context, id)
|
||||
config = []
|
||||
for config_item in config_items:
|
||||
config_inf = self.db_api.config_get(req.context, config_item['config_id'])
|
||||
config_file = self.db_api.config_file_get(req.context, config_inf['config_file_id'])
|
||||
config_inf = self.db_api.config_get(req.context,
|
||||
config_item['config_id'])
|
||||
config_file = self.db_api.config_file_get(
|
||||
req.context,
|
||||
config_inf['config_file_id'])
|
||||
if config_file:
|
||||
config_inf['config_file_name'] = config_file['name']
|
||||
config.append(config_inf)
|
||||
|
||||
@@ -582,7 +582,7 @@ class Controller(object):
|
||||
"""Get cinder_volumes, wrapping in exception if necessary."""
|
||||
try:
|
||||
return self.db_api.optical_switch_list(context, filters=filters,
|
||||
**params)
|
||||
**params)
|
||||
except exception.NotFound:
|
||||
LOG.warn(_LW("Invalid marker. optical switch %(id)s "
|
||||
"could not be found.") %
|
||||
|
||||
@@ -232,19 +232,23 @@ class Controller(object):
|
||||
:param req: wsgi Request object
|
||||
:param body: Dictionary of information about the template config
|
||||
|
||||
:retval Returns the newly-created template function information as a mapping,
|
||||
which will include the newly-created template function's internal id
|
||||
:retval Returns the newly-created template function
|
||||
information as a mapping,
|
||||
which will include the newly-created template
|
||||
function's internal id
|
||||
in the 'id' field
|
||||
"""
|
||||
|
||||
template_config_data = body["template_config_metadata"]
|
||||
|
||||
try:
|
||||
template_config_data = self.db_api.template_config_import(req.context, template_config_data)
|
||||
template_config_data = self.db_api.template_config_import(
|
||||
req.context, template_config_data)
|
||||
msg = (_LI("Successfully import template function %s") %
|
||||
template_config_data)
|
||||
LOG.info(msg)
|
||||
template_config_data = dict(template_config_metadata=template_config_data)
|
||||
template_config_data = dict(
|
||||
template_config_metadata=template_config_data)
|
||||
return template_config_data
|
||||
except exception.Duplicate:
|
||||
msg = (_("template function with identifier %s already exists!") %
|
||||
@@ -296,18 +300,22 @@ class Controller(object):
|
||||
LOG.info(msg)
|
||||
return exc.HTTPNotFound()
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to delete template_config_id %s") % template_config_id)
|
||||
LOG.exception(_LE("Unable to delete template_config_id %s")
|
||||
% template_config_id)
|
||||
raise
|
||||
|
||||
@utils.mutating
|
||||
def get_template_config(self, req, template_config_id):
|
||||
"""Return data about the given template config id."""
|
||||
try:
|
||||
template_config_data = self.db_api.template_config_get(req.context, template_config_id)
|
||||
msg = "Successfully retrieved template config %(id)s" % {'id': template_config_id}
|
||||
template_config_data = self.db_api.template_config_get(
|
||||
req.context, template_config_id)
|
||||
msg = "Successfully retrieved template config %(id)s" \
|
||||
% {'id': template_config_id}
|
||||
LOG.debug(msg)
|
||||
except exception.NotFound:
|
||||
msg = _LI("template_config %(id)s not found") % {'id': template_config_id}
|
||||
msg = _LI("template_config %(id)s not found") \
|
||||
% {'id': template_config_id}
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except exception.Forbidden:
|
||||
@@ -318,7 +326,8 @@ class Controller(object):
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to show template_config %s") % template_config_id)
|
||||
LOG.exception(_LE("Unable to show template_config %s")
|
||||
% template_config_id)
|
||||
raise
|
||||
template_config = dict(template_config=template_config_data)
|
||||
return template_config
|
||||
|
||||
@@ -39,7 +39,7 @@ _LW = i18n._LW
|
||||
CONF = cfg.CONF
|
||||
|
||||
DISPLAY_FIELDS_IN_INDEX = ['id', 'func_name', 'ch_desc', 'en_desc',
|
||||
'data_type','data_check_script']
|
||||
'data_type', 'data_check_script']
|
||||
|
||||
SUPPORTED_FILTERS = ['id', 'func_name', 'cluster_id']
|
||||
|
||||
@@ -58,8 +58,8 @@ class Controller(object):
|
||||
"""Get template functions, wrapping in exception if necessary."""
|
||||
try:
|
||||
return self.db_api.template_func_get_all(context,
|
||||
filters=filters,
|
||||
**params)
|
||||
filters=filters,
|
||||
**params)
|
||||
except exception.NotFound:
|
||||
LOG.warn(_LW("Invalid marker. template function %(id)s could not "
|
||||
"be found.") % {'id': params.get('marker')})
|
||||
@@ -254,7 +254,7 @@ class Controller(object):
|
||||
|
||||
try:
|
||||
template_func_data = self.db_api.template_func_import(
|
||||
req.context,template_func_data)
|
||||
req.context, template_func_data)
|
||||
msg = (_LI("Successfully import template function %s") %
|
||||
template_func_data)
|
||||
LOG.info(msg)
|
||||
|
||||
@@ -215,11 +215,14 @@ class Controller(object):
|
||||
def get_template_service(self, req, template_service_id):
|
||||
"""Return data about the given template function id."""
|
||||
try:
|
||||
template_service_data = self.db_api.template_service_get(req.context, template_service_id)
|
||||
msg = "Successfully retrieved template function %(id)s" % {'id': template_service_id}
|
||||
template_service_data = self.db_api.template_service_get(
|
||||
req.context, template_service_id)
|
||||
msg = "Successfully retrieved template function %(id)s" \
|
||||
% {'id': template_service_id}
|
||||
LOG.debug(msg)
|
||||
except exception.NotFound:
|
||||
msg = _LI("template_service %(id)s not found") % {'id': template_service_id}
|
||||
msg = _LI("template_service %(id)s not found") % \
|
||||
{'id': template_service_id}
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except exception.Forbidden:
|
||||
@@ -230,7 +233,8 @@ class Controller(object):
|
||||
LOG.info(msg)
|
||||
raise exc.HTTPNotFound()
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to show template_service %s") % template_service_id)
|
||||
LOG.exception(_LE("Unable to show template_service %s")
|
||||
% template_service_id)
|
||||
raise
|
||||
template_service = dict(template_service=template_service_data)
|
||||
return template_service
|
||||
|
||||
Reference in New Issue
Block a user