Merge "De-client-ify Service Create"
This commit is contained in:
commit
479d9ac450
@ -145,7 +145,7 @@ class ShadeAdapter(adapter.Adapter):
|
||||
'flavor', 'flavors', 'baymodels', 'aggregate',
|
||||
'aggregates', 'availabilityZoneInfo',
|
||||
'flavor_access', 'output', 'server_groups', 'domain',
|
||||
'domains']:
|
||||
'domains', 'service', 'OS-KSADM:service']:
|
||||
if key in result_json.keys():
|
||||
self._log_request_id(response)
|
||||
return result_json
|
||||
|
@ -127,11 +127,6 @@ class MachineSetProvision(task_manager.Task):
|
||||
return client.ironic_client.node.set_provision_state(**self.args)
|
||||
|
||||
|
||||
class ServiceCreate(task_manager.Task):
|
||||
def main(self, client):
|
||||
return client.keystone_client.services.create(**self.args)
|
||||
|
||||
|
||||
class ServiceList(task_manager.Task):
|
||||
def main(self, client):
|
||||
return client.keystone_client.services.list()
|
||||
|
@ -756,18 +756,18 @@ class OperatorCloud(openstackcloud.OpenStackCloud):
|
||||
# TODO(mordred) When this changes to REST, force interface=admin
|
||||
# in the adapter call
|
||||
if self.cloud_config.get_api_version('identity').startswith('2'):
|
||||
kwargs['service_type'] = type_ or service_type
|
||||
url, key = '/OS-KSADM/services', 'OS-KSADM:service'
|
||||
kwargs['type'] = type_ or service_type
|
||||
else:
|
||||
url, key = '/services', 'service'
|
||||
kwargs['type'] = type_ or service_type
|
||||
kwargs['enabled'] = enabled
|
||||
kwargs['name'] = name
|
||||
|
||||
with _utils.shade_exceptions(
|
||||
"Failed to create service {name}".format(name=name)
|
||||
):
|
||||
service = self.manager.submit_task(
|
||||
_tasks.ServiceCreate(name=name, **kwargs)
|
||||
)
|
||||
|
||||
msg = 'Failed to create service {name}'.format(name=name)
|
||||
data = self._identity_client.post(
|
||||
url, json={key: kwargs}, error_message=msg)
|
||||
service = meta.get_and_munchify(key, data)
|
||||
return _utils.normalize_keystone_services([service])[0]
|
||||
|
||||
@_utils.valid_kwargs('name', 'enabled', 'type', 'service_type',
|
||||
|
@ -47,12 +47,7 @@ class CloudServices(base.RequestsMockTestCase):
|
||||
uri=self.get_mock_url(base_url_append='OS-KSADM'),
|
||||
status_code=200,
|
||||
json=service_data.json_response_v2,
|
||||
validate=dict(json={'OS-KSADM:service': reference_req})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(base_url_append='OS-KSADM',
|
||||
append=[service_data.service_id]),
|
||||
status_code=200,
|
||||
json=service_data.json_response_v2)
|
||||
validate=dict(json={'OS-KSADM:service': reference_req}))
|
||||
])
|
||||
|
||||
service = self.op_cloud.create_service(
|
||||
@ -76,11 +71,7 @@ class CloudServices(base.RequestsMockTestCase):
|
||||
uri=self.get_mock_url(),
|
||||
status_code=200,
|
||||
json=service_data.json_response_v3,
|
||||
validate=dict(json={'service': service_data.json_request})),
|
||||
dict(method='GET',
|
||||
uri=self.get_mock_url(append=[service_data.service_id]),
|
||||
status_code=200,
|
||||
json=service_data.json_response_v3)
|
||||
validate=dict(json={'service': service_data.json_request}))
|
||||
])
|
||||
|
||||
service = self.op_cloud.create_service(
|
||||
|
Loading…
x
Reference in New Issue
Block a user