Skip to content

Commit

Permalink
[devcenter] Handle JSON error in "az devcenter dev environment show-l…
Browse files Browse the repository at this point in the history
…ogs-by-operation" (Azure#7535)

* Update project env type parameters

* Fix environment def example and update style

* Fix show logs

* Fix spacing

* Fix style error

* Fix integraion tests

* Fix gallery test

* Fix gallery test

* Fix gallery compute

* Update
  • Loading branch information
am-lim authored Apr 23, 2024
1 parent 2a895ff commit a63d5ca
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 60 deletions.
4 changes: 4 additions & 0 deletions src/devcenter/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
5.0.1
++++++
* Fix bug in "az devcenter dev environment show-logs-by-operation" if logs is not in JSON format

5.0.0
++++++
* Require roles and identity type parameters in "az decenter admin project-environment-type create"
Expand Down
2 changes: 1 addition & 1 deletion src/devcenter/azext_devcenter/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=protected-access

# pylint: disable=no-self-use

import argparse
from collections import defaultdict
Expand Down
8 changes: 6 additions & 2 deletions src/devcenter/azext_devcenter/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,8 +1205,12 @@ def devcenter_environment_operation_show_logs_by_operation(
)
logs_array = []
for log in logs:
logs_string = json.loads(log)
logs_array.append(logs_string)
if log:
try:
logs_string = json.loads(log)
logs_array.append(logs_string)
except json.JSONDecodeError:
logs_array.append(log)
return logs_array


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/cli000004/subnets/cli000005?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/cli000004/subnets/cli000005?api-version=2023-09-01
response:
body:
string: "{\r\n \"name\": \"cli000005\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/cli000004/subnets/cli000005\"\
Expand All @@ -920,7 +920,7 @@ interactions:
azure-asyncnotification:
- Enabled
azure-asyncoperation:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/4cb6a702-4cc7-4e41-99e4-7635ad7857eb?api-version=2023-05-01
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/4cb6a702-4cc7-4e41-99e4-7635ad7857eb?api-version=2023-09-01
cache-control:
- no-cache
content-length:
Expand Down Expand Up @@ -964,7 +964,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/4cb6a702-4cc7-4e41-99e4-7635ad7857eb?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/4cb6a702-4cc7-4e41-99e4-7635ad7857eb?api-version=2023-09-01
response:
body:
string: "{\r\n \"status\": \"Succeeded\"\r\n}"
Expand Down Expand Up @@ -1010,7 +1010,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/cli000004/subnets/cli000005?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/cli000004/subnets/cli000005?api-version=2023-09-01
response:
body:
string: "{\r\n \"name\": \"cli000005\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.Network/virtualNetworks/cli000004/subnets/cli000005\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-09-01
response:
body:
string: "{\r\n \"name\": \"cli000006\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006\"\
Expand All @@ -1266,7 +1266,7 @@ interactions:
azure-asyncnotification:
- Enabled
azure-asyncoperation:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/086b9cb5-da19-4d52-8a98-f014ced21f0d?api-version=2023-05-01
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/086b9cb5-da19-4d52-8a98-f014ced21f0d?api-version=2023-09-01
cache-control:
- no-cache
content-length:
Expand Down Expand Up @@ -1310,7 +1310,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/086b9cb5-da19-4d52-8a98-f014ced21f0d?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/086b9cb5-da19-4d52-8a98-f014ced21f0d?api-version=2023-09-01
response:
body:
string: "{\r\n \"status\": \"Succeeded\"\r\n}"
Expand Down Expand Up @@ -1356,7 +1356,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-09-01
response:
body:
string: "{\r\n \"name\": \"cli000006\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-09-01
response:
body:
string: "{\r\n \"name\": \"cli000006\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006\"\
Expand All @@ -1358,7 +1358,7 @@ interactions:
azure-asyncnotification:
- Enabled
azure-asyncoperation:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/a5d93084-1bf5-4b62-b055-2abf89cd6080?api-version=2023-05-01
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/a5d93084-1bf5-4b62-b055-2abf89cd6080?api-version=2023-09-01
cache-control:
- no-cache
content-length:
Expand Down Expand Up @@ -1402,7 +1402,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/a5d93084-1bf5-4b62-b055-2abf89cd6080?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Network/locations/canadacentral/operations/a5d93084-1bf5-4b62-b055-2abf89cd6080?api-version=2023-09-01
response:
body:
string: "{\r\n \"status\": \"Succeeded\"\r\n}"
Expand Down Expand Up @@ -1448,7 +1448,7 @@ interactions:
User-Agent:
- AZURECLI/2.51.0 (AAZ) azsdk-python-core/1.24.0 Python/3.10.7 (Windows-10-10.0.22621-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-05-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006?api-version=2023-09-01
response:
body:
string: "{\r\n \"name\": \"cli000006\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli000002/providers/Microsoft.Network/virtualNetworks/cli000005/subnets/cli000006\"\
Expand Down
Loading

0 comments on commit a63d5ca

Please sign in to comment.