Explicitly specify arguments of server_groups creation
Create API call expectes two parameters - name and policies[*]. It is not a complex structure, so there is no reason to support kwargs. It is better to specify explicitly all expected parameters. PS: removing support of kwargs is "backward compatible", since we have validation at API side and usage of additional parameters was an error previously. [*] - https://developer.openstack.org/api-ref/compute/?expanded=create-server-group-detail Change-Id: I8b40b0db450287bbc5ee8d69834aa764353dbd98
This commit is contained in:
parent
85106a6f70
commit
773aea23b8
novaclient/v2
@ -84,10 +84,15 @@ class ServerGroupsManager(base.ManagerWithFind):
|
||||
"""
|
||||
return self._delete('/os-server-groups/%s' % id)
|
||||
|
||||
def create(self, **kwargs):
|
||||
def create(self, name, policies):
|
||||
"""Create (allocate) a server group.
|
||||
|
||||
:param name: The name of the server group.
|
||||
:param policies: Policy name or a list of exactly one policy name to
|
||||
associate with the server group.
|
||||
:rtype: list of :class:`ServerGroup`
|
||||
"""
|
||||
body = {'server_group': kwargs}
|
||||
policies = policies if isinstance(policies, list) else [policies]
|
||||
body = {'server_group': {'name': name,
|
||||
'policies': policies}}
|
||||
return self._create('/os-server-groups', body, 'server_group')
|
||||
|
@ -4280,9 +4280,8 @@ def do_server_group_list(cs, args):
|
||||
help=_('Policies for the server groups.'))
|
||||
def do_server_group_create(cs, args):
|
||||
"""Create a new server group with the specified details."""
|
||||
kwargs = {'name': args.name,
|
||||
'policies': args.policy}
|
||||
server_group = cs.server_groups.create(**kwargs)
|
||||
server_group = cs.server_groups.create(name=args.name,
|
||||
policies=args.policy)
|
||||
_print_server_group_details(cs, [server_group])
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user