Don't remove top-container for stack and zone REST API calls
Change-Id: I502c7a7bcae7a7efd6541d50cc9837c04d48cb63 Signed-off-by: Rosario Di Somma <rosario.disomma@dreamhost.com>
This commit is contained in:
parent
ebedf176c7
commit
5d204c3269
@ -134,7 +134,8 @@ class ShadeAdapter(adapter.Adapter):
|
||||
'volume_types', 'volume_type_access', 'snapshots',
|
||||
'network', 'networks', 'subnet', 'subnets',
|
||||
'router', 'routers', 'floatingip', 'floatingips',
|
||||
'floating_ip', 'floating_ips', 'port', 'ports']:
|
||||
'floating_ip', 'floating_ips', 'port', 'ports',
|
||||
'stack', 'stacks', 'zones', 'events']:
|
||||
if key in result_json.keys():
|
||||
self._log_request_id(response)
|
||||
return result_json
|
||||
|
@ -15,6 +15,8 @@
|
||||
import collections
|
||||
import time
|
||||
|
||||
from shade import meta
|
||||
|
||||
|
||||
def get_events(cloud, stack_id, event_args, marker=None, limit=None):
|
||||
# TODO(mordred) FIX THIS ONCE assert_calls CAN HANDLE QUERY STRINGS
|
||||
@ -27,9 +29,10 @@ def get_events(cloud, stack_id, event_args, marker=None, limit=None):
|
||||
if limit:
|
||||
event_args['limit'] = limit
|
||||
|
||||
events = cloud._orchestration_client.get(
|
||||
data = cloud._orchestration_client.get(
|
||||
'/stacks/{id}/events'.format(id=stack_id),
|
||||
params=params)
|
||||
events = meta.get_and_munchify('events', data)
|
||||
|
||||
# Show which stack the event comes from (for nested events)
|
||||
for e in events:
|
||||
|
@ -582,7 +582,7 @@ def get_and_munchify(key, data):
|
||||
The value will be converted in a Munch object or a list of Munch objects
|
||||
based on the type
|
||||
"""
|
||||
result = data.get(key, [])
|
||||
result = data.get(key, []) if key else data
|
||||
if isinstance(result, list):
|
||||
return obj_list_to_munch(result)
|
||||
elif isinstance(result, dict):
|
||||
|
@ -1761,9 +1761,10 @@ class OpenStackCloud(
|
||||
:raises: ``OpenStackCloudException`` if something goes wrong during the
|
||||
OpenStack API call.
|
||||
"""
|
||||
stacks = self._orchestration_client.get(
|
||||
data = self._orchestration_client.get(
|
||||
'/stacks', error_message="Error fetching stack list")
|
||||
return self._normalize_stacks(stacks)
|
||||
return self._normalize_stacks(
|
||||
meta.get_and_munchify('stacks', data))
|
||||
|
||||
def list_server_security_groups(self, server):
|
||||
"""List all security groups associated with the given server.
|
||||
@ -2873,9 +2874,10 @@ class OpenStackCloud(
|
||||
# stack names are mandatory and enforced unique in the project
|
||||
# so a StackGet can always be used for name or ID.
|
||||
try:
|
||||
stack = self._orchestration_client.get(
|
||||
data = self._orchestration_client.get(
|
||||
'/stacks/{name_or_id}'.format(name_or_id=name_or_id),
|
||||
error_message="Error fetching stack")
|
||||
stack = meta.get_and_munchify('stack', data)
|
||||
# Treat DELETE_COMPLETE stacks as a NotFound
|
||||
if stack['stack_status'] == 'DELETE_COMPLETE':
|
||||
return []
|
||||
@ -7009,9 +7011,10 @@ class OpenStackCloud(
|
||||
:returns: A list of zones dicts.
|
||||
|
||||
"""
|
||||
return self._dns_client.get(
|
||||
data = self._dns_client.get(
|
||||
"/zones",
|
||||
error_message="Error fetching zones list")
|
||||
return meta.get_and_munchify('zones', data)
|
||||
|
||||
def get_zone(self, name_or_id, filters=None):
|
||||
"""Get a zone by name or ID.
|
||||
@ -7030,7 +7033,7 @@ class OpenStackCloud(
|
||||
|
||||
def search_zones(self, name_or_id=None, filters=None):
|
||||
zones = self.list_zones()
|
||||
return _utils._filter_list(zones['zones'], name_or_id, filters)
|
||||
return _utils._filter_list(zones, name_or_id, filters)
|
||||
|
||||
def create_zone(self, name, zone_type=None, email=None, description=None,
|
||||
ttl=None, masters=None):
|
||||
@ -7073,9 +7076,10 @@ class OpenStackCloud(
|
||||
if masters is not None:
|
||||
zone["masters"] = masters
|
||||
|
||||
return self._dns_client.post(
|
||||
data = self._dns_client.post(
|
||||
"/zones", json=zone,
|
||||
error_message="Unable to create zone {name}".format(name=name))
|
||||
return meta.get_and_munchify(key=None, data=data)
|
||||
|
||||
@_utils.valid_kwargs('email', 'description', 'ttl', 'masters')
|
||||
def update_zone(self, name_or_id, **kwargs):
|
||||
@ -7098,9 +7102,10 @@ class OpenStackCloud(
|
||||
raise OpenStackCloudException(
|
||||
"Zone %s not found." % name_or_id)
|
||||
|
||||
return self._dns_client.patch(
|
||||
data = self._dns_client.patch(
|
||||
"/zones/{zone_id}".format(zone_id=zone['id']), json=kwargs,
|
||||
error_message="Error updating zone {0}".format(name_or_id))
|
||||
return meta.get_and_munchify(key=None, data=data)
|
||||
|
||||
def delete_zone(self, name_or_id):
|
||||
"""Delete a zone.
|
||||
|
Loading…
x
Reference in New Issue
Block a user