Misleading output when network is not found

Output is:
Unable to find network with name '7ea795c9-0b72-4585-bd91-9bf83c0d1c80'
Output should be:
Unable to find network with name or id

Someone could think that the net id is not checked.

Closes-Bug: #1544907
Change-Id: I6999ab4e07a58751a9860764447c00fe7bf8ee81
This commit is contained in:
Nikolas Hermanns
2016-02-12 11:21:25 +01:00
parent 2bf12749bc
commit a147631309

View File

@@ -118,9 +118,17 @@ def find_resource_by_name_or_id(client, resource, name_or_id,
return find_resource_by_id(client, resource, name_or_id,
cmd_resource, parent_id, fields)
except exceptions.NotFound:
return _find_resource_by_name(client, resource, name_or_id,
project_id, cmd_resource, parent_id,
fields)
try:
return _find_resource_by_name(client, resource, name_or_id,
project_id, cmd_resource, parent_id,
fields)
except exceptions.NotFound:
not_found_message = (_("Unable to find %(resource)s with name "
"or id '%(name_or_id)s'") %
{'resource': resource,
'name_or_id': name_or_id})
raise exceptions.NotFound(
message=not_found_message)
def find_resourceid_by_name_or_id(client, resource, name_or_id,