Putting context as the first parameter

Re-order parameters at format_container
Closes-Bug: #1771882

Change-Id: I9ac8b4a0faf221b0baa22f6f1e880f781e7ae278
This commit is contained in:
Ritu Sitlani 2018-06-11 11:21:34 +00:00 committed by ritu
parent 4d1453ede4
commit 9d05d7fdc0
2 changed files with 10 additions and 10 deletions

View File

@ -70,7 +70,7 @@ class ContainerCollection(collection.Collection):
context = pecan.request.context
collection = ContainerCollection()
collection.containers = \
[view.format_container(url, p, context) for p in rpc_containers]
[view.format_container(context, url, p) for p in rpc_containers]
collection.next = collection.get_next(limit, url=url, **kwargs)
return collection
@ -259,8 +259,8 @@ class ContainersController(base.Controller):
except exception.ContainerHostNotUp:
raise exception.ServerNotUsable
return view.format_container(pecan.request.host_url, container,
context)
return view.format_container(context, pecan.request.host_url,
container)
def _generate_name_for_container(self):
"""Generate a random name like: zeta-22-container."""
@ -367,8 +367,8 @@ class ContainersController(base.Controller):
pecan.response.location = link.build_url('containers',
new_container.uuid)
pecan.response.status = 202
return view.format_container(pecan.request.host_url, new_container,
context)
return view.format_container(context, pecan.request.host_url,
new_container)
def _set_default_resource_limit(self, container_dict):
# NOTE(kiennt): Default disk size will be set later.
@ -571,8 +571,8 @@ class ContainersController(base.Controller):
context = pecan.request.context
compute_api = pecan.request.compute_api
container = compute_api.container_update(context, container, patch)
return view.format_container(pecan.request.host_url, container,
context)
return view.format_container(context, pecan.request.host_url,
container)
@base.Controller.api_version("1.1", "1.13")
@pecan.expose('json')
@ -592,8 +592,8 @@ class ContainersController(base.Controller):
container.name = name
context = pecan.request.context
container.save(context)
return view.format_container(pecan.request.host_url, container,
context)
return view.format_container(context, pecan.request.host_url,
container)
@pecan.expose('json')
@exception.wrap_pecan_controller_exception

View File

@ -50,7 +50,7 @@ _basic_keys = (
)
def format_container(url, container, context):
def format_container(context, url, container):
def transform(key, value):
if key not in _basic_keys:
return