summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Baker <sbaker@redhat.com>2016-08-25 12:22:26 +1200
committerSteve Baker <sbaker@redhat.com>2016-08-25 12:22:26 +1200
commit573b6657f0c16fec7a63274bb779c01933c67609 (patch)
treee6596a9828bb2ab2b23c255fc6a51ed983166d51
parent060f11372bf54f8097aeea5b5b04c2bdcc87f047 (diff)
downloadpython-heatclient-573b6657f0c16fec7a63274bb779c01933c67609.tar.gz
Add a nested_depth argument to poll_for_events
This will allow library calls to have more control over the depth of events which are logged. Change-Id: Iecb8c89745f916c50936e013a62176d586cfcc63 Closes-Bug: #1616682
-rw-r--r--heatclient/common/event_utils.py4
-rw-r--r--heatclient/tests/unit/test_event_utils.py9
2 files changed, 7 insertions, 6 deletions
diff --git a/heatclient/common/event_utils.py b/heatclient/common/event_utils.py
index 18a0b98..6acbbd6 100644
--- a/heatclient/common/event_utils.py
+++ b/heatclient/common/event_utils.py
@@ -166,7 +166,7 @@ def _get_stack_events(hc, stack_id, event_args):
def poll_for_events(hc, stack_name, action=None, poll_period=5, marker=None,
- out=None):
+ out=None, nested_depth=0):
"""Continuously poll events and logs for performed action on stack."""
if action:
@@ -180,7 +180,7 @@ def poll_for_events(hc, stack_name, action=None, poll_period=5, marker=None,
if not out:
out = sys.stdout
while True:
- events = get_events(hc, stack_id=stack_name,
+ events = get_events(hc, stack_id=stack_name, nested_depth=nested_depth,
event_args={'sort_dir': 'asc',
'marker': marker})
diff --git a/heatclient/tests/unit/test_event_utils.py b/heatclient/tests/unit/test_event_utils.py
index 098d2b5..32e4473 100644
--- a/heatclient/tests/unit/test_event_utils.py
+++ b/heatclient/tests/unit/test_event_utils.py
@@ -150,10 +150,10 @@ class ShellTestEventUtils(testtools.TestCase):
self.assertEqual('CREATE_COMPLETE', stack_status)
self.assertEqual('\n Stack astack CREATE_COMPLETE \n', msg)
ge.assert_has_calls([
- mock.call(None, stack_id='astack', event_args={
+ mock.call(None, stack_id='astack', nested_depth=0, event_args={
'sort_dir': 'asc', 'marker': None
}),
- mock.call(None, stack_id='astack', event_args={
+ mock.call(None, stack_id='astack', nested_depth=0, event_args={
'sort_dir': 'asc', 'marker': '4'
})
])
@@ -168,11 +168,12 @@ class ShellTestEventUtils(testtools.TestCase):
]]
stack_status, msg = event_utils.poll_for_events(
- None, 'astack', action='CREATE', poll_period=0, marker='4')
+ None, 'astack', action='CREATE', poll_period=0, marker='4',
+ nested_depth=0)
self.assertEqual('CREATE_COMPLETE', stack_status)
self.assertEqual('\n Stack astack CREATE_COMPLETE \n', msg)
ge.assert_has_calls([
- mock.call(None, stack_id='astack', event_args={
+ mock.call(None, stack_id='astack', nested_depth=0, event_args={
'sort_dir': 'asc', 'marker': '4'
})
])