Pass kwargs to exception to get better formatted error message
This is to pass kwargs to NodeNotFound, and to fix kwargs for MissingParameterValue, to get better formatted error message. Change-Id: I0efae0ed94741ebf7ca77904cc1e34230e65d5d5
This commit is contained in:
parent
ce110c5fb5
commit
320a61b685
@ -449,7 +449,7 @@ class Connection(api.Connection):
|
|||||||
host=node['reservation'])
|
host=node['reservation'])
|
||||||
return node
|
return node
|
||||||
except NoResultFound:
|
except NoResultFound:
|
||||||
raise exception.NodeNotFound(node_id)
|
raise exception.NodeNotFound(node=node_id)
|
||||||
|
|
||||||
@oslo_db_api.retry_on_deadlock
|
@oslo_db_api.retry_on_deadlock
|
||||||
def release_node(self, tag, node_id):
|
def release_node(self, tag, node_id):
|
||||||
@ -468,7 +468,7 @@ class Connection(api.Connection):
|
|||||||
raise exception.NodeLocked(node=node.uuid,
|
raise exception.NodeLocked(node=node.uuid,
|
||||||
host=node['reservation'])
|
host=node['reservation'])
|
||||||
except NoResultFound:
|
except NoResultFound:
|
||||||
raise exception.NodeNotFound(node_id)
|
raise exception.NodeNotFound(node=node_id)
|
||||||
|
|
||||||
@oslo_db_api.retry_on_deadlock
|
@oslo_db_api.retry_on_deadlock
|
||||||
def create_node(self, values):
|
def create_node(self, values):
|
||||||
@ -1090,7 +1090,7 @@ class Connection(api.Connection):
|
|||||||
query = add_identity_filter(query, node_id)
|
query = add_identity_filter(query, node_id)
|
||||||
count = query.update({'provision_updated_at': timeutils.utcnow()})
|
count = query.update({'provision_updated_at': timeutils.utcnow()})
|
||||||
if count == 0:
|
if count == 0:
|
||||||
raise exception.NodeNotFound(node_id)
|
raise exception.NodeNotFound(node=node_id)
|
||||||
|
|
||||||
def _check_node_exists(self, node_id):
|
def _check_node_exists(self, node_id):
|
||||||
if not model_query(models.Node).filter_by(id=node_id).scalar():
|
if not model_query(models.Node).filter_by(id=node_id).scalar():
|
||||||
|
@ -144,7 +144,7 @@ def get_server_hardware_id(node):
|
|||||||
msg = (_("Error validating node driver info, "
|
msg = (_("Error validating node driver info, "
|
||||||
"server uuid: %s missing xclarity_hardware_id") %
|
"server uuid: %s missing xclarity_hardware_id") %
|
||||||
node.uuid)
|
node.uuid)
|
||||||
raise exception.MissingParameterValue(error=msg)
|
raise exception.MissingParameterValue(err=msg)
|
||||||
return xclarity_hardware_id
|
return xclarity_hardware_id
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user