Fixing validation exception for valid security group
Now casting the id of the allowed security group to a
six.text_type() to avoid type mismatching when using ids.
Change-Id: Iff2e442501d9c85c2b73c9a36114728830b04701
Closes-Bug: #1384743
(cherry picked from commit fc1b5c8463
)
This commit is contained in:
parent
2158805503
commit
35b881f933
|
@ -17,6 +17,7 @@ import operator
|
|||
|
||||
import novaclient.exceptions as nova_ex
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
from sahara import conductor as cond
|
||||
from sahara import context
|
||||
|
@ -147,7 +148,8 @@ def check_flavor_exists(flavor_id):
|
|||
def check_security_groups_exist(security_groups):
|
||||
security_group_list = nova.client().security_groups.list()
|
||||
allowed_groups = set(reduce(
|
||||
operator.add, [[sg.id, sg.name] for sg in security_group_list], []))
|
||||
operator.add, [[six.text_type(sg.id), sg.name]
|
||||
for sg in security_group_list], []))
|
||||
for sg in security_groups:
|
||||
if sg not in allowed_groups:
|
||||
raise ex.InvalidException(_("Security group '%s' not found") % sg)
|
||||
|
|
Loading…
Reference in New Issue