Skip to content

Commit 738c433

Browse files
ABZhang0Alan Zhang
authored andcommitted
AMG: fix issue with dashboard json validation (Azure#8373)
* Check if "isFolder" exists before validation * update pe test recording * Switch to folder overwrite * Change link in string and regenerate relevant test recordings --------- Co-authored-by: Alan Zhang <[email protected]>
1 parent c811bea commit 738c433

File tree

7 files changed

+4490
-4520
lines changed

7 files changed

+4490
-4520
lines changed

src/amg/HISTORY.rst

+5
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,8 @@ Release History
122122
2.5.3
123123
++++++
124124
* `az grafana service-account token create`: set token default expiration time to 1 day as stated in the documentation
125+
126+
2.5.4
127+
++++++
128+
* `az grafana dashboard import`: fix issue with JSON file validation
129+
* `az grafana folder update`: fix issue with overwrite setting

src/amg/azext_amg/aaz/latest/grafana/__cmd_group.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class __CMDGroup(AAZCommandGroup):
1818
"""Commands to manage Azure Managed Grafana resources.
1919
20-
For optimized experience, not all data plane APIs, documented at https://grafana.com/docs/grafana/latest/http_api/, are exposed. On coverage gap, please reach out to [email protected]
20+
For optimized experience, not all data plane APIs, documented at `https://grafana.com/docs/grafana/latest/http_api/`, are exposed. On coverage gap, please reach out to [email protected]
2121
"""
2222
pass
2323

src/amg/azext_amg/custom.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def import_dashboard(cmd, grafana_name, definition, folder=None, resource_group_
386386
import copy
387387
data = _try_load_dashboard_definition(cmd, resource_group_name, grafana_name, definition,
388388
api_key_or_token=api_key_or_token)
389-
if data["meta"]["isFolder"]:
389+
if data.get("meta", {}).get("isFolder", False):
390390
raise ArgumentUsageError("The provided definition is a folder, not a dashboard")
391391

392392
if "dashboard" in data:
@@ -555,10 +555,9 @@ def list_folders(cmd, grafana_name, resource_group_name=None, api_key_or_token=N
555555

556556
def update_folder(cmd, grafana_name, folder, title, resource_group_name=None, api_key_or_token=None):
557557
f = show_folder(cmd, grafana_name, folder, resource_group_name, api_key_or_token=api_key_or_token)
558-
version = f['version']
559558
data = {
560559
"title": title,
561-
"version": int(version)
560+
"overwrite": True
562561
}
563562
response = _send_request(cmd, resource_group_name, grafana_name, "put", "/api/folders/" + f["uid"], data,
564563
api_key_or_token=api_key_or_token)

src/amg/azext_amg/tests/latest/recordings/test_amg_migrate_override.yaml

+2,328-2,372
Large diffs are not rendered by default.

src/amg/azext_amg/tests/latest/recordings/test_amg_migrate_simple_e2e.yaml

+1,664-1,706
Large diffs are not rendered by default.

src/amg/azext_amg/tests/latest/recordings/test_amg_private_endpoint.yaml

+489-437
Large diffs are not rendered by default.

src/amg/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# TODO: Confirm this is the right version number you want and it matches your
1818
# HISTORY.rst entry.
19-
VERSION = '2.5.3'
19+
VERSION = '2.5.4'
2020

2121
# The full list of classifiers is available at
2222
# https://pypi.python.org/pypi?%3Aaction=list_classifiers

0 commit comments

Comments
 (0)