Skip to content

Commit

Permalink
Fix lack of raised exception on receieve client error (monitor-events).
Browse files Browse the repository at this point in the history
  • Loading branch information
digimaun committed Jan 29, 2020
1 parent b9d5ec5 commit 11ba5a8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Release History
===============

0.8.9
+++++++++++++++
- Updated uamqp version to ~1.2.
- Simplified out-of-band dependency installation message.
- If uamqp installation fails the error is raised on stderr rather than having to use --debug.
- amqp frame traces are not shown when --debug is passed in to event monitoring.
- Fixed monitor-events not raising an exception if receiver client runs into an error.

0.8.8
+++++++++++++++
- Adds Jobs v2 command set.
Expand Down
12 changes: 6 additions & 6 deletions azext_iot/operations/events3/_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def stop_and_suppress_eloop():
loop.run_forever()
finally:
if result:
error = next(res for res in result if result)
if error:
logger.error(error)
raise RuntimeError(error)
errors = result[0]
if errors and errors[0]:
logger.debug(errors)
raise RuntimeError(errors[0])


async def initiate_event_monitor(
Expand Down Expand Up @@ -148,7 +148,7 @@ def _get_conn_props():
pnp_context=pnp_context,
)
)
await asyncio.gather(*coroutines, return_exceptions=True)
return await asyncio.gather(*coroutines, return_exceptions=True)


async def monitor_events(
Expand Down Expand Up @@ -254,7 +254,7 @@ def _output_msg_kpi(msg):

exp_cancelled = False
receive_client = uamqp.ReceiveClientAsync(
source, auth=auth, timeout=timeout, prefetch=0, debug=DEBUG
source, auth=auth, timeout=timeout, prefetch=0, client_name=_get_container_id(), debug=DEBUG
)

try:
Expand Down
11 changes: 7 additions & 4 deletions azext_iot/operations/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,10 +1318,13 @@ def iot_device_upload_file(cmd, device_id, file_path, content_type, hub_name=Non
def iot_hub_monitor_events(cmd, hub_name=None, device_id=None, consumer_group='$Default', timeout=300,
enqueued_time=None, resource_group_name=None, yes=False, properties=None, repair=False,
login=None, content_type=None, device_query=None):
_iot_hub_monitor_events(cmd, hub_name=hub_name, device_id=device_id,
consumer_group=consumer_group, timeout=timeout, enqueued_time=enqueued_time,
resource_group_name=resource_group_name, yes=yes, properties=properties,
repair=repair, login=login, content_type=content_type, device_query=device_query)
try:
_iot_hub_monitor_events(cmd, hub_name=hub_name, device_id=device_id,
consumer_group=consumer_group, timeout=timeout, enqueued_time=enqueued_time,
resource_group_name=resource_group_name, yes=yes, properties=properties,
repair=repair, login=login, content_type=content_type, device_query=device_query)
except RuntimeError as e:
raise CLIError(e)


def iot_hub_monitor_feedback(cmd, hub_name=None, device_id=None, yes=False,
Expand Down

0 comments on commit 11ba5a8

Please sign in to comment.