Trivial: Fix typo in find() in network.

Change-Id: Ic54fbb9160adefe3d025d537125e125128f75ee6
This commit is contained in:
Tang Chen 2015-11-27 16:52:56 +08:00
parent c48afe6032
commit a2047d3f9f

View File

@ -27,7 +27,8 @@ def find(client, resource, resources, name_or_id, name_attr='name'):
n = find(netclient, 'network', 'networks', 'matrix')
"""
list_method = getattr(client, "list_%s" % resources)
# Search for by name
# Search by name
kwargs = {name_attr: name_or_id, 'fields': 'id'}
data = list_method(**kwargs)
info = data[resources]
@ -36,7 +37,8 @@ def find(client, resource, resources, name_or_id, name_attr='name'):
if len(info) > 1:
msg = "More than one %s exists with the name '%s'."
raise exceptions.CommandError(msg % (resource, name_or_id))
# Search for by id
# Search by id
data = list_method(id=name_or_id, fields='id')
info = data[resources]
if len(info) == 1: