diff options
author | Simon Collins <simoncollins99@gmail.com> | 2018-01-17 12:11:15 +1300 |
---|---|---|
committer | Saverio Proto <saverio.proto@switch.ch> | 2018-01-31 07:45:00 +0000 |
commit | 5c7aa1422f5328a06528ba5db25732087513f8e4 (patch) | |
tree | 27a46810733419b0a70ad163884f81ac174f8a59 | |
parent | a4d0288ceb63442d35c736090079923c085d52d0 (diff) | |
download | horizon-5c7aa1422f5328a06528ba5db25732087513f8e4.tar.gz |
Security group quota error handling
When adding a new rule to a secruity group that would exceede the
quota, the error message displays a quota error, rather than rule
already exists error. It does this my first checking for an
"OverQuotaClient" error, then if that except doesn't trigger it
checks for any other conflict
Change-Id: I8eaa0f00b25c8c3b75fef2bf46979f1f248c6896
Closes-Bug: #1699724
(cherry picked from commit 3929a8b7cd893f0b4c0ff6c20d5d1fd9077b4dd2)
-rw-r--r-- | openstack_dashboard/api/neutron.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py index b97d42341..6ab0df314 100644 --- a/openstack_dashboard/api/neutron.py +++ b/openstack_dashboard/api/neutron.py @@ -318,8 +318,12 @@ class SecurityGroupManager(network_base.SecurityGroupManager): 'remote_group_id': group_id}} try: rule = self.client.create_security_group_rule(body) + except neutron_exc.OverQuotaClient: + raise exceptions.Conflict( + _('Security group rule quotas exceed.')) except neutron_exc.Conflict: - raise exceptions.Conflict(_('Security group rule already exists.')) + raise exceptions.Conflict( + _('Security group rule already exists.')) rule = rule.get('security_group_rule') sg_dict = self._sg_name_dict(parent_group_id, [rule]) return SecurityGroupRule(rule, sg_dict) |