diff options
author | Thomas Herve <therve@redhat.com> | 2016-11-03 09:57:58 +0100 |
---|---|---|
committer | Thomas Herve <therve@redhat.com> | 2016-12-19 14:55:33 +0100 |
commit | 6f94cfd791e434e9932da18d785feb934d802a44 (patch) | |
tree | 6ab79ae2058dc964309e9b34a40abf1e49247a95 /heatclient/common/utils.py | |
parent | 61794b78220a556cb110d1c948e6eedd55f224c0 (diff) | |
download | python-heatclient-6f94cfd791e434e9932da18d785feb934d802a44.tar.gz |
Add convenience function for events over websocket
This adds an alternative method of poll_for_events using a websocket
connection.
Change-Id: I1c46af3ab98b6d108af976e4fab5282c8756a626
Diffstat (limited to 'heatclient/common/utils.py')
-rw-r--r-- | heatclient/common/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py index 91410ac..3ebfede 100644 --- a/heatclient/common/utils.py +++ b/heatclient/common/utils.py @@ -125,6 +125,8 @@ class EventLogContext(object): # future calls to build_resource_name def get_stack_id(): + if getattr(event, 'stack_id', None) is not None: + return event.stack_id for l in getattr(event, 'links', []): if l.get('rel') == 'stack': if 'href' not in l: @@ -135,8 +137,8 @@ class EventLogContext(object): stack_id = get_stack_id() if not stack_id: return res_name - phys_id = getattr(event, 'physical_resource_id') - status = getattr(event, 'resource_status') + phys_id = getattr(event, 'physical_resource_id', None) + status = getattr(event, 'resource_status', None) is_stack_event = stack_id == phys_id if is_stack_event: |