Fix net check return error when net_obj get value is "None"

Closes-Bug: #1777774

Change-Id: I6073a075837ee3fdaa6f09c49b76aacbc0d90226
This commit is contained in:
Yuanbin.Chen 2018-08-22 09:34:03 +08:00 committed by Erik Olof Gunnar Andersson
parent 0c6fbcf7c4
commit d27cba4d5c
1 changed files with 5 additions and 0 deletions

View File

@ -517,6 +517,8 @@ class ServerProfile(base.Profile):
return
try:
net_obj = nc.network_get(net)
if net_obj is None:
return _("The specified network %s could not be found.") % net
result[self.NETWORK] = net_obj.id
except exc.InternalError as ex:
return six.text_type(ex)
@ -554,6 +556,9 @@ class ServerProfile(base.Profile):
if net:
try:
net_obj = nc.network_get(net)
if net_obj is None:
return _("The floating network %s could not be found."
) % net
result[self.FLOATING_NETWORK] = net_obj.id
except exc.InternalError as ex:
return six.text_type(ex)