Merge "Remove 'links' section from several v3 Identity objects"
This commit is contained in:
commit
79a9331f95
openstackclient
@ -73,6 +73,7 @@ class CreateCredential(show.ShowOne):
|
||||
blob=parsed_args.data,
|
||||
project=project)
|
||||
|
||||
credential._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(credential._info)))
|
||||
|
||||
|
||||
@ -193,4 +194,5 @@ class ShowCredential(show.ShowOne):
|
||||
credential = utils.find_resource(identity_client.credentials,
|
||||
parsed_args.credential)
|
||||
|
||||
credential._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(credential._info)))
|
||||
|
@ -66,6 +66,7 @@ class CreateDomain(show.ShowOne):
|
||||
enabled=parsed_args.enabled,
|
||||
)
|
||||
|
||||
domain._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(domain._info)))
|
||||
|
||||
|
||||
@ -187,4 +188,5 @@ class ShowDomain(show.ShowOne):
|
||||
domain = utils.find_resource(identity_client.domains,
|
||||
parsed_args.domain)
|
||||
|
||||
domain._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(domain._info)))
|
||||
|
@ -81,6 +81,7 @@ class CreateEndpoint(show.ShowOne):
|
||||
)
|
||||
|
||||
info = {}
|
||||
endpoint._info.pop('links')
|
||||
info.update(endpoint._info)
|
||||
info['service_name'] = service.name
|
||||
info['service_type'] = service.type
|
||||
@ -258,6 +259,7 @@ class ShowEndpoint(show.ShowOne):
|
||||
service = common.find_service(identity_client, endpoint.service_id)
|
||||
|
||||
info = {}
|
||||
endpoint._info.pop('links')
|
||||
info.update(endpoint._info)
|
||||
info['service_name'] = service.name
|
||||
info['service_type'] = service.type
|
||||
|
@ -138,9 +138,8 @@ class CreateGroup(show.ShowOne):
|
||||
domain=domain,
|
||||
description=parsed_args.description)
|
||||
|
||||
info = {}
|
||||
info.update(group._info)
|
||||
return zip(*sorted(six.iteritems(info)))
|
||||
group._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(group._info)))
|
||||
|
||||
|
||||
class DeleteGroup(command.Command):
|
||||
@ -340,4 +339,5 @@ class ShowGroup(show.ShowOne):
|
||||
group = utils.find_resource(identity_client.groups,
|
||||
parsed_args.group)
|
||||
|
||||
group._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(group._info)))
|
||||
|
@ -55,6 +55,7 @@ class CreatePolicy(show.ShowOne):
|
||||
blob=blob, type=parsed_args.type
|
||||
)
|
||||
|
||||
policy._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(policy._info)))
|
||||
|
||||
|
||||
@ -173,4 +174,5 @@ class ShowPolicy(show.ShowOne):
|
||||
policy = utils.find_resource(identity_client.policies,
|
||||
parsed_args.policy)
|
||||
|
||||
policy._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(policy._info)))
|
||||
|
@ -94,9 +94,8 @@ class CreateProject(show.ShowOne):
|
||||
**kwargs
|
||||
)
|
||||
|
||||
info = {}
|
||||
info.update(project._info)
|
||||
return zip(*sorted(six.iteritems(info)))
|
||||
project._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(project._info)))
|
||||
|
||||
|
||||
class DeleteProject(command.Command):
|
||||
@ -229,7 +228,7 @@ class SetProject(command.Command):
|
||||
parsed_args.project,
|
||||
)
|
||||
|
||||
kwargs = project._info
|
||||
kwargs = {}
|
||||
if parsed_args.name:
|
||||
kwargs['name'] = parsed_args.name
|
||||
if parsed_args.domain:
|
||||
@ -243,13 +242,6 @@ class SetProject(command.Command):
|
||||
kwargs['enabled'] = False
|
||||
if parsed_args.property:
|
||||
kwargs.update(parsed_args.property)
|
||||
if 'id' in kwargs:
|
||||
del kwargs['id']
|
||||
if 'domain_id' in kwargs:
|
||||
# Hack around broken Identity API arg names
|
||||
kwargs.update(
|
||||
{'domain': kwargs.pop('domain_id')}
|
||||
)
|
||||
|
||||
identity_client.projects.update(project.id, **kwargs)
|
||||
return
|
||||
@ -287,4 +279,5 @@ class ShowProject(show.ShowOne):
|
||||
project = utils.find_resource(identity_client.projects,
|
||||
parsed_args.project)
|
||||
|
||||
project._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(project._info)))
|
||||
|
@ -157,6 +157,7 @@ class CreateRole(show.ShowOne):
|
||||
|
||||
role = identity_client.roles.create(name=parsed_args.name)
|
||||
|
||||
role._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(role._info)))
|
||||
|
||||
|
||||
@ -472,4 +473,5 @@ class ShowRole(show.ShowOne):
|
||||
parsed_args.role,
|
||||
)
|
||||
|
||||
role._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(role._info)))
|
||||
|
@ -70,6 +70,7 @@ class CreateService(show.ShowOne):
|
||||
enabled=enabled,
|
||||
)
|
||||
|
||||
service._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(service._info)))
|
||||
|
||||
|
||||
@ -161,7 +162,7 @@ class SetService(command.Command):
|
||||
|
||||
service = common.find_service(identity_client, parsed_args.service)
|
||||
|
||||
kwargs = service._info
|
||||
kwargs = {}
|
||||
if parsed_args.type:
|
||||
kwargs['type'] = parsed_args.type
|
||||
if parsed_args.name:
|
||||
@ -170,8 +171,6 @@ class SetService(command.Command):
|
||||
kwargs['enabled'] = True
|
||||
if parsed_args.disable:
|
||||
kwargs['enabled'] = False
|
||||
if 'id' in kwargs:
|
||||
del kwargs['id']
|
||||
|
||||
identity_client.services.update(
|
||||
service.id,
|
||||
@ -200,4 +199,5 @@ class ShowService(show.ShowOne):
|
||||
|
||||
service = common.find_service(identity_client, parsed_args.service)
|
||||
|
||||
service._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(service._info)))
|
||||
|
@ -116,9 +116,8 @@ class CreateUser(show.ShowOne):
|
||||
enabled=enabled
|
||||
)
|
||||
|
||||
info = {}
|
||||
info.update(user._info)
|
||||
return zip(*sorted(six.iteritems(info)))
|
||||
user._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(user._info)))
|
||||
|
||||
|
||||
class DeleteUser(command.Command):
|
||||
@ -382,4 +381,5 @@ class ShowUser(show.ShowOne):
|
||||
user = utils.find_resource(identity_client.users,
|
||||
parsed_args.user)
|
||||
|
||||
user._info.pop('links')
|
||||
return zip(*sorted(six.iteritems(user._info)))
|
||||
|
@ -18,6 +18,7 @@ import mock
|
||||
from openstackclient.tests import fakes
|
||||
from openstackclient.tests import utils
|
||||
|
||||
base_url = 'http://identity:5000/v3/'
|
||||
|
||||
domain_id = 'd1'
|
||||
domain_name = 'oftheking'
|
||||
@ -28,6 +29,7 @@ DOMAIN = {
|
||||
'name': domain_name,
|
||||
'description': domain_description,
|
||||
'enabled': True,
|
||||
'links': base_url + 'domains/' + domain_id,
|
||||
}
|
||||
|
||||
group_id = 'gr-010'
|
||||
@ -36,6 +38,7 @@ group_name = 'spencer davis'
|
||||
GROUP = {
|
||||
'id': group_id,
|
||||
'name': group_name,
|
||||
'links': base_url + 'groups/' + group_id,
|
||||
}
|
||||
|
||||
mapping_id = 'test_mapping'
|
||||
@ -107,6 +110,7 @@ PROJECT = {
|
||||
'description': project_description,
|
||||
'enabled': True,
|
||||
'domain_id': domain_id,
|
||||
'links': base_url + 'projects/' + project_id,
|
||||
}
|
||||
|
||||
PROJECT_2 = {
|
||||
@ -115,6 +119,7 @@ PROJECT_2 = {
|
||||
'description': project_description + 'plus four more',
|
||||
'enabled': True,
|
||||
'domain_id': domain_id,
|
||||
'links': base_url + 'projects/' + project_id,
|
||||
}
|
||||
|
||||
role_id = 'r1'
|
||||
@ -123,6 +128,7 @@ role_name = 'roller'
|
||||
ROLE = {
|
||||
'id': role_id,
|
||||
'name': role_name,
|
||||
'links': base_url + 'roles/' + role_id,
|
||||
}
|
||||
|
||||
service_id = 's-123'
|
||||
@ -134,6 +140,7 @@ SERVICE = {
|
||||
'name': service_name,
|
||||
'type': service_type,
|
||||
'enabled': True,
|
||||
'links': base_url + 'services/' + service_id,
|
||||
}
|
||||
|
||||
endpoint_id = 'e-123'
|
||||
@ -148,6 +155,7 @@ ENDPOINT = {
|
||||
'interface': endpoint_interface,
|
||||
'service_id': service_id,
|
||||
'enabled': True,
|
||||
'links': base_url + 'endpoints/' + endpoint_id,
|
||||
}
|
||||
|
||||
user_id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
|
||||
@ -162,6 +170,7 @@ USER = {
|
||||
'email': user_email,
|
||||
'enabled': True,
|
||||
'domain_id': domain_id,
|
||||
'links': base_url + 'users/' + user_id,
|
||||
}
|
||||
|
||||
token_expires = '2014-01-01T00:00:00Z'
|
||||
|
@ -533,9 +533,6 @@ class TestProjectSet(TestProject):
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'description': identity_fakes.project_description,
|
||||
'domain': identity_fakes.domain_id,
|
||||
'enabled': True,
|
||||
'name': 'qwerty',
|
||||
}
|
||||
# ProjectManager.update(project, name=, domain=, description=,
|
||||
@ -564,9 +561,6 @@ class TestProjectSet(TestProject):
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'description': 'new desc',
|
||||
'domain': identity_fakes.domain_id,
|
||||
'enabled': True,
|
||||
'name': identity_fakes.project_name,
|
||||
}
|
||||
self.projects_mock.update.assert_called_with(
|
||||
identity_fakes.project_id,
|
||||
@ -590,10 +584,7 @@ class TestProjectSet(TestProject):
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'description': identity_fakes.project_description,
|
||||
'domain': identity_fakes.domain_id,
|
||||
'enabled': True,
|
||||
'name': identity_fakes.project_name,
|
||||
}
|
||||
self.projects_mock.update.assert_called_with(
|
||||
identity_fakes.project_id,
|
||||
@ -617,10 +608,7 @@ class TestProjectSet(TestProject):
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'description': identity_fakes.project_description,
|
||||
'domain': identity_fakes.domain_id,
|
||||
'enabled': False,
|
||||
'name': identity_fakes.project_name,
|
||||
}
|
||||
self.projects_mock.update.assert_called_with(
|
||||
identity_fakes.project_id,
|
||||
@ -644,10 +632,6 @@ class TestProjectSet(TestProject):
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'description': identity_fakes.project_description,
|
||||
'domain': identity_fakes.domain_id,
|
||||
'enabled': True,
|
||||
'name': identity_fakes.project_name,
|
||||
'fee': 'fi',
|
||||
'fo': 'fum',
|
||||
}
|
||||
|
@ -267,9 +267,7 @@ class TestServiceSet(TestService):
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'name': identity_fakes.service_name,
|
||||
'type': identity_fakes.service_type,
|
||||
'enabled': True,
|
||||
}
|
||||
# ServiceManager.update(service, name=, type=, enabled=, **kwargs)
|
||||
self.services_mock.update.assert_called_with(
|
||||
@ -297,8 +295,6 @@ class TestServiceSet(TestService):
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'name': identity_fakes.service_name,
|
||||
'type': identity_fakes.service_type,
|
||||
'enabled': True,
|
||||
}
|
||||
# ServiceManager.update(service, name=, type=, enabled=, **kwargs)
|
||||
self.services_mock.update.assert_called_with(
|
||||
@ -325,8 +321,6 @@ class TestServiceSet(TestService):
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'name': identity_fakes.service_name,
|
||||
'type': identity_fakes.service_type,
|
||||
'enabled': True,
|
||||
}
|
||||
# ServiceManager.update(service, name=, type=, enabled=, **kwargs)
|
||||
@ -354,8 +348,6 @@ class TestServiceSet(TestService):
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'name': identity_fakes.service_name,
|
||||
'type': identity_fakes.service_type,
|
||||
'enabled': False,
|
||||
}
|
||||
# ServiceManager.update(service, name=, type=, enabled=, **kwargs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user