Merge "Raise exception for nova egress secgroup rule"
This commit is contained in:
commit
8b5d2f5efc
|
@ -3111,6 +3111,12 @@ class OpenStackCloud(object):
|
|||
if protocol is None:
|
||||
raise OpenStackCloudException('Protocol must be specified')
|
||||
|
||||
if direction == 'egress':
|
||||
self.log.debug(
|
||||
'Rule creation failed: Nova does not support egress rules'
|
||||
)
|
||||
raise OpenStackCloudException('No support for egress rules')
|
||||
|
||||
# NOTE: Neutron accepts None for ports, but Nova requires -1
|
||||
# as the equivalent value for ICMP.
|
||||
#
|
||||
|
|
|
@ -324,3 +324,12 @@ class TestSecurityGroups(base.TestCase):
|
|||
)
|
||||
r = self.cloud.delete_security_group('doesNotExist')
|
||||
self.assertFalse(r)
|
||||
|
||||
@mock.patch.object(shade.OpenStackCloud, 'nova_client')
|
||||
def test_nova_egress_security_group_rule(self, mock_nova):
|
||||
self.cloud.secgroup_source = 'nova'
|
||||
mock_nova.security_groups.list.return_value = [nova_grp_obj]
|
||||
self.assertRaises(shade.OpenStackCloudException,
|
||||
self.cloud.create_security_group_rule,
|
||||
secgroup_name_or_id='nova-sec-group',
|
||||
direction='egress')
|
||||
|
|
Loading…
Reference in New Issue