diff options
author | Steven Pisarski <s.pisarski@cablelabs.com> | 2017-08-07 14:33:04 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-07 14:33:04 +0000 |
commit | 2ac22f4647ab776f0c19180886bf3fc04e687368 (patch) | |
tree | 9a94f371da60a9053f59721299f0efa27539d21a /snaps/openstack/utils/neutron_utils.py | |
parent | ab9f8a4967f665d70efbcce8bdf7f993a1bf33de (diff) | |
parent | be88521949fd488dd0a3b1eff214f82511f2a6d5 (diff) |
Merge "Delete 'default' security group associated to new projects."
Diffstat (limited to 'snaps/openstack/utils/neutron_utils.py')
-rw-r--r-- | snaps/openstack/utils/neutron_utils.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/snaps/openstack/utils/neutron_utils.py b/snaps/openstack/utils/neutron_utils.py index 061bc56..2de3586 100644 --- a/snaps/openstack/utils/neutron_utils.py +++ b/snaps/openstack/utils/neutron_utils.py @@ -347,7 +347,7 @@ def delete_security_group(neutron, sec_grp): neutron.delete_security_group(sec_grp.id) -def get_security_group(neutron, name): +def get_security_group(neutron, name, tenant_id=None): """ Returns the first security group object of the given name else None :param neutron: the client @@ -356,7 +356,10 @@ def get_security_group(neutron, name): """ logger.info('Retrieving security group with name - ' + name) - groups = neutron.list_security_groups(**{'name': name}) + filter = {'name': name} + if tenant_id: + filter['tenant_id'] = tenant_id + groups = neutron.list_security_groups(**filter) for group in groups['security_groups']: if group['name'] == name: return SecurityGroup(**group) |