Skip to content

Commit 249b755

Browse files
authored
Fixes device run-ro command failure when response is missing some fields, and updates tests (#8813)
* Adds check and tests for empty fields * Updates link
1 parent eaea83e commit 249b755

File tree

5 files changed

+315
-4
lines changed

5 files changed

+315
-4
lines changed

src/managednetworkfabric/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release History
44
===============
55

6+
8.0.0b4
7+
++++++
8+
* Fixes 'device run-ro' command for missing fields in the response.
9+
610
8.0.0b3
711
++++++
812
* Adding custom output formatting for 'device' run-ro command

src/managednetworkfabric/azext_managednetworkfabric/operations/custom_properties.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ def _output(parent_cmd, *args, **kwargs): # pylint: disable=unused-argument
3030
op_response = parent_cmd.ctx.vars.instance.properties.to_serialized_data()
3131

3232
new_properties = {}
33-
new_properties["configurationState"] = op_response["configurationState"]
34-
new_properties["outputUrl"] = op_response["outputUrl"]
33+
34+
if has_value(parent_cmd.ctx.vars.instance.properties.configuration_state):
35+
new_properties["configurationState"] = op_response["configurationState"]
36+
37+
if has_value(parent_cmd.ctx.vars.instance.properties.output_url):
38+
new_properties["outputUrl"] = op_response["outputUrl"]
3539

3640
if has_value(
3741
parent_cmd.ctx.vars.instance.properties.device_configuration_preview
@@ -50,6 +54,6 @@ def _output(parent_cmd, *args, **kwargs): # pylint: disable=unused-argument
5054
logger.warning(json_string)
5155
new_properties["deviceConfigurationPreview"] = json_string
5256
else:
53-
new_properties["deviceConfigurationPreview"] = "{}"
57+
new_properties["deviceConfigurationPreview"] = {}
5458

5559
return new_properties

0 commit comments

Comments
 (0)