diff options
author | ricolin <rico.lin@easystack.cn> | 2017-07-19 21:34:46 +0800 |
---|---|---|
committer | Rico Lin <rico.lin@easystack.cn> | 2017-08-07 05:39:29 +0000 |
commit | 552f94b928dc859d06d8b3d6fa0824aefdbf1cb5 (patch) | |
tree | 1395bdd23d525be2070252dd91b2e97c539c6948 /heat/api | |
parent | d5f78c2b289ac8f082604978f25af1a0dc93fa42 (diff) | |
download | heat-552f94b928dc859d06d8b3d6fa0824aefdbf1cb5.tar.gz |
Add converge flag in stack update for observing on reality
Add converge parameter for stack update API and RPC call,
that allow triggering observe on reality. This will be
triggered by API call with converge argument (with True
or False value) within. This flag also works for resources
within nested stack.
Implements bp get-reality-for-resources
Change-Id: I151b575b714dcc9a5971a1573c126152ecd7ea93
Diffstat (limited to 'heat/api')
-rw-r--r-- | heat/api/openstack/v1/stacks.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/heat/api/openstack/v1/stacks.py b/heat/api/openstack/v1/stacks.py index 1eef46e83..11520ac09 100644 --- a/heat/api/openstack/v1/stacks.py +++ b/heat/api/openstack/v1/stacks.py @@ -374,7 +374,7 @@ class StackController(object): formatted_stack = stacks_view.format_stack(req, result) return {'stack': formatted_stack} - def prepare_args(self, data): + def prepare_args(self, data, is_update=False): args = data.args() key = rpc_api.PARAM_TIMEOUT if key in args: @@ -382,6 +382,11 @@ class StackController(object): key = rpc_api.PARAM_TAGS if args.get(key) is not None: args[key] = self._extract_tags_param(args[key]) + key = rpc_api.PARAM_CONVERGE + if not is_update and key in args: + msg = _("%s flag only supported in stack update (or update " + "preview) request.") % key + raise exc.HTTPBadRequest(six.text_type(msg)) return args @util.policy_enforce @@ -472,7 +477,7 @@ class StackController(object): """Update an existing stack with a new template and/or parameters.""" data = InstantiationData(body) - args = self.prepare_args(data) + args = self.prepare_args(data, is_update=True) self.rpc_client.update_stack( req.context, identity, @@ -493,7 +498,7 @@ class StackController(object): """ data = InstantiationData(body, patch=True) - args = self.prepare_args(data) + args = self.prepare_args(data, is_update=True) self.rpc_client.update_stack( req.context, identity, @@ -518,7 +523,7 @@ class StackController(object): """Preview update for existing stack with a new template/parameters.""" data = InstantiationData(body) - args = self.prepare_args(data) + args = self.prepare_args(data, is_update=True) show_nested = self._param_show_nested(req) if show_nested is not None: args[rpc_api.PARAM_SHOW_NESTED] = show_nested @@ -538,7 +543,7 @@ class StackController(object): """Preview PATCH update for existing stack.""" data = InstantiationData(body, patch=True) - args = self.prepare_args(data) + args = self.prepare_args(data, is_update=True) show_nested = self._param_show_nested(req) if show_nested is not None: args['show_nested'] = show_nested |