Skip to content

Commit

Permalink
Fix drop id attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
David Alvarez Quiroga authored and angelbarrera92 committed Mar 11, 2021
1 parent 5662505 commit aa67107
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion grafana/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def create(api, name, title, jsonDashboard, organizationNames, lock, logge
api.organizations.switch_organization(orgId)
jsonDashboard['uid'] = name
jsonDashboard['title'] = title if title else name
del jsonDashboard['id']
jsonDashboard.pop('id', None)
dashboard_object = {
'dashboard': jsonDashboard,
'folderId': 0,
Expand Down
4 changes: 2 additions & 2 deletions grafana/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async def create(api, name, jsonDatasource, organizationNames, lock, logger):
api.organizations.switch_organization(orgId)
jsonDatasource['name'] = name
if jsonDatasource.get('id'):
del jsonDatasource['id']
jsonDatasource.pop('id', None)
response = api.datasource.create_datasource(jsonDatasource)
responses.append(response)
except GrafanaException as err:
Expand Down Expand Up @@ -75,7 +75,7 @@ async def update(api, oldName, newName, newJsonDatasource, oldOrganizationNames,
try:
newJsonDatasource['name'] = newName
if newJsonDatasource.get('id'):
del newJsonDatasource['id']
newJsonDatasource.pop('id', None)
response = api.datasource.create_datasource(newJsonDatasource)
responses.append(response)
except GrafanaException as err:
Expand Down
2 changes: 1 addition & 1 deletion grafana/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _create_dashboards(api, dashboards, orgId):
# Override the uid and title
dashboardParsed['uid'] = dashboardName
dashboardParsed['title'] = dashboardName
del dashboardParsed['id']
dashboardParsed.pop('id', None)
dashboard_object = {
'dashboard': dashboardParsed,
'folderId': 0,
Expand Down

0 comments on commit aa67107

Please sign in to comment.