Rename security_group parameter in compute.API:create
This changes the formal parameter name to be 'security_groups' so it's plural given it's a list and not a single security group. Change-Id: I243f689a30168b9081200f03a2ae060a4971e131
This commit is contained in:
parent
b2db12d357
commit
c53d94891b
@ -527,10 +527,10 @@ class SecurityGroups(extensions.V21APIExtensionBase):
|
||||
def server_create(self, server_dict, create_kwargs, body_deprecated_param):
|
||||
security_groups = server_dict.get(ATTRIBUTE_NAME)
|
||||
if security_groups is not None:
|
||||
create_kwargs['security_group'] = [
|
||||
create_kwargs['security_groups'] = [
|
||||
sg['name'] for sg in security_groups if sg.get('name')]
|
||||
create_kwargs['security_group'] = list(
|
||||
set(create_kwargs['security_group']))
|
||||
create_kwargs['security_groups'] = list(
|
||||
set(create_kwargs['security_groups']))
|
||||
|
||||
def get_server_create_schema(self, version):
|
||||
if version == '2.0':
|
||||
|
@ -103,7 +103,7 @@ class CloudPipe(object):
|
||||
display_name=instance_name,
|
||||
user_data=user_data,
|
||||
key_name=key_name,
|
||||
security_group=[group_name])
|
||||
security_groups=[group_name])
|
||||
|
||||
def setup_security_group(self, context):
|
||||
group_name = '%s%s' % (context.project_id,
|
||||
|
@ -1481,7 +1481,7 @@ class API(base.Base):
|
||||
image_href, kernel_id=None, ramdisk_id=None,
|
||||
min_count=None, max_count=None,
|
||||
display_name=None, display_description=None,
|
||||
key_name=None, key_data=None, security_group=None,
|
||||
key_name=None, key_data=None, security_groups=None,
|
||||
availability_zone=None, forced_host=None, forced_node=None,
|
||||
user_data=None, metadata=None, injected_files=None,
|
||||
admin_password=None, block_device_mapping=None,
|
||||
@ -1518,7 +1518,7 @@ class API(base.Base):
|
||||
image_href, kernel_id, ramdisk_id,
|
||||
min_count, max_count,
|
||||
display_name, display_description,
|
||||
key_name, key_data, security_group,
|
||||
key_name, key_data, security_groups,
|
||||
availability_zone, user_data, metadata,
|
||||
injected_files, admin_password,
|
||||
access_ip_v4, access_ip_v6,
|
||||
|
@ -2705,7 +2705,7 @@ class ServersControllerCreateTest(test.TestCase):
|
||||
'security_groups': [{'name': ' sg '}]}
|
||||
|
||||
def fake_create(*args, **kwargs):
|
||||
self.assertEqual([' sg '], kwargs['security_group'])
|
||||
self.assertEqual([' sg '], kwargs['security_groups'])
|
||||
return (objects.InstanceList(objects=[fakes.stub_instance_obj(
|
||||
self.req.environ['nova.context'])]), None)
|
||||
|
||||
|
@ -7743,7 +7743,7 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
self.context,
|
||||
instance_type=flavors.get_default_flavor(),
|
||||
image_href=uuids.image_href_id,
|
||||
security_group=['testgroup'])
|
||||
security_groups=['testgroup'])
|
||||
|
||||
groups_for_instance = db.security_group_get_by_instance(
|
||||
self.context, ref[0]['uuid'])
|
||||
@ -7763,7 +7763,7 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
self.context,
|
||||
instance_type=instance_type,
|
||||
image_href=None,
|
||||
security_group=['this_is_a_fake_sec_group'])
|
||||
security_groups=['this_is_a_fake_sec_group'])
|
||||
self.assertEqual(pre_build_len,
|
||||
len(db.instance_get_all(self.context)))
|
||||
|
||||
@ -7902,7 +7902,7 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
self.context,
|
||||
instance_type=flavors.get_default_flavor(),
|
||||
image_href=uuids.image_href_id,
|
||||
security_group=['testgroup'])
|
||||
security_groups=['testgroup'])
|
||||
|
||||
db.instance_destroy(self.context, ref[0]['uuid'])
|
||||
group = db.security_group_get(self.context, group['id'],
|
||||
@ -7917,7 +7917,7 @@ class ComputeAPITestCase(BaseTestCase):
|
||||
self.context,
|
||||
instance_type=flavors.get_default_flavor(),
|
||||
image_href=uuids.image_href_id,
|
||||
security_group=['testgroup'])
|
||||
security_groups=['testgroup'])
|
||||
|
||||
db.security_group_destroy(self.context, group['id'])
|
||||
admin_deleted_context = context.get_admin_context(
|
||||
|
Loading…
Reference in New Issue
Block a user