Trivial: Fix typo in find() in network.
Change-Id: Ic54fbb9160adefe3d025d537125e125128f75ee6
This commit is contained in:
parent
c48afe6032
commit
a2047d3f9f
@ -27,7 +27,8 @@ def find(client, resource, resources, name_or_id, name_attr='name'):
|
|||||||
n = find(netclient, 'network', 'networks', 'matrix')
|
n = find(netclient, 'network', 'networks', 'matrix')
|
||||||
"""
|
"""
|
||||||
list_method = getattr(client, "list_%s" % resources)
|
list_method = getattr(client, "list_%s" % resources)
|
||||||
# Search for by name
|
|
||||||
|
# Search by name
|
||||||
kwargs = {name_attr: name_or_id, 'fields': 'id'}
|
kwargs = {name_attr: name_or_id, 'fields': 'id'}
|
||||||
data = list_method(**kwargs)
|
data = list_method(**kwargs)
|
||||||
info = data[resources]
|
info = data[resources]
|
||||||
@ -36,7 +37,8 @@ def find(client, resource, resources, name_or_id, name_attr='name'):
|
|||||||
if len(info) > 1:
|
if len(info) > 1:
|
||||||
msg = "More than one %s exists with the name '%s'."
|
msg = "More than one %s exists with the name '%s'."
|
||||||
raise exceptions.CommandError(msg % (resource, name_or_id))
|
raise exceptions.CommandError(msg % (resource, name_or_id))
|
||||||
# Search for by id
|
|
||||||
|
# Search by id
|
||||||
data = list_method(id=name_or_id, fields='id')
|
data = list_method(id=name_or_id, fields='id')
|
||||||
info = data[resources]
|
info = data[resources]
|
||||||
if len(info) == 1:
|
if len(info) == 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user