summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorricolin <rico.lin@easystack.cn>2017-05-01 03:09:55 +0800
committerRico Lin <rico.lin@easystack.cn>2017-10-20 03:17:58 +0000
commit58e357908ea1617e7fdf758766b1813b42487803 (patch)
tree88113a21bd011e47e7b2f45585e812cae5d8cf12
parent4722facf06d813fd5ec76de7a662a723f3ddee29 (diff)
downloadpython-heatclient-58e357908ea1617e7fdf758766b1813b42487803.tar.gz
Add `--converge` argument for osc stack update
This patch add `--converge` argument for osc stack update. This flag will be used as the trigger for observe on reality. implements bp get-reality-for-resources depends-on: I151b575b714dcc9a5971a1573c126152ecd7ea93 Change-Id: If35e1b9234cab173b3c46601bbd331aceebcbcb3
-rw-r--r--heatclient/osc/v1/stack.py8
-rw-r--r--heatclient/tests/unit/osc/v1/test_stack.py10
-rw-r--r--releasenotes/notes/add-converge-in-osc-stack-update-10f256589f628d13.yaml8
3 files changed, 26 insertions, 0 deletions
diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py
index 4a64221..4490d1e 100644
--- a/heatclient/osc/v1/stack.py
+++ b/heatclient/osc/v1/stack.py
@@ -278,6 +278,11 @@ class UpdateStack(command.ShowOne):
help=_('Wait until stack goes to UPDATE_COMPLETE or '
'UPDATE_FAILED')
)
+ parser.add_argument(
+ '--converge',
+ action='store_true',
+ help=_('Stack update with observe on reality.')
+ )
return parser
@@ -354,6 +359,9 @@ class UpdateStack(command.ShowOne):
limit=1)
marker = events[0].id if events else None
+ if parsed_args.converge:
+ fields['converge'] = True
+
client.stacks.update(**fields)
if parsed_args.wait:
diff --git a/heatclient/tests/unit/osc/v1/test_stack.py b/heatclient/tests/unit/osc/v1/test_stack.py
index 54fe9be..2eb3ab9 100644
--- a/heatclient/tests/unit/osc/v1/test_stack.py
+++ b/heatclient/tests/unit/osc/v1/test_stack.py
@@ -304,6 +304,16 @@ class TestStackUpdate(TestStack):
self.stack_client.update.assert_called_with(**kwargs)
+ def test_stack_update_converge(self):
+ arglist = ['my_stack', '-t', self.template_path, '--converge']
+ kwargs = copy.deepcopy(self.defaults)
+ kwargs['converge'] = True
+ parsed_args = self.check_parser(self.cmd, arglist, [])
+
+ self.cmd.take_action(parsed_args)
+
+ self.stack_client.update.assert_called_with(**kwargs)
+
def test_stack_update_pre_update(self):
arglist = ['my_stack', '-t', self.template_path, '--pre-update', 'a']
kwargs = copy.deepcopy(self.defaults)
diff --git a/releasenotes/notes/add-converge-in-osc-stack-update-10f256589f628d13.yaml b/releasenotes/notes/add-converge-in-osc-stack-update-10f256589f628d13.yaml
new file mode 100644
index 0000000..70f65d3
--- /dev/null
+++ b/releasenotes/notes/add-converge-in-osc-stack-update-10f256589f628d13.yaml
@@ -0,0 +1,8 @@
+---
+features:
+ - Adds '--converge' option for stack update with openstackclient. If
+ specified, existing resource attributes (which may have diverged) are
+ compared with the resource properties in the template used for update.
+
+ Usage:
+ # openstack stack update --converge ... <stack_name> \ No newline at end of file