Skip to content

Commit

Permalink
Run pre-commit after update
Browse files Browse the repository at this point in the history
  • Loading branch information
lkubb committed Aug 19, 2024
1 parent b46ff75 commit b7cb636
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/saltext/grafana/states/grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
they exist in dashboards. The module will not manage rows that are not defined,
allowing users to manage their own custom rows.
"""

import copy

import salt.utils.json
Expand Down
17 changes: 9 additions & 8 deletions src/saltext/grafana/states/grafana4_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
title: Imaginary
type: graph
"""

import copy

import salt.utils.json
Expand Down Expand Up @@ -165,14 +166,14 @@ def present(
if updated_needed:
if __opts__["test"]:
ret["result"] = None
ret[
"comment"
] = "Dashboard {} is set to be updated, changes={}".format( # pylint: disable=consider-using-f-string
name,
salt.utils.json.dumps(
_dashboard_diff(_cleaned(new_dashboard), _cleaned(old_dashboard)),
indent=4,
),
ret["comment"] = (
"Dashboard {} is set to be updated, changes={}".format( # pylint: disable=consider-using-f-string
name,
salt.utils.json.dumps(
_dashboard_diff(_cleaned(new_dashboard), _cleaned(old_dashboard)),
indent=4,
),
)
)
return ret

Expand Down
1 change: 1 addition & 0 deletions src/saltext/grafana/states/grafana4_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- basic_auth_password: mypass
- is_default: true
"""

from salt.utils.dictdiffer import deep_diff


Expand Down
9 changes: 5 additions & 4 deletions src/saltext/grafana/states/grafana4_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- state: ""
- country: ""
"""

import salt.utils.dictupdate as dictupdate
from requests.exceptions import HTTPError
from salt.utils.dictdiffer import deep_diff
Expand Down Expand Up @@ -189,10 +190,10 @@ def present(
)
elif role != db_users[username]["role"]:
if __opts__["test"]:
ret[
"comment"
] = "Org {} user {} role will be updated".format( # pylint: disable=consider-using-f-string
name, username
ret["comment"] = (
"Org {} user {} role will be updated".format( # pylint: disable=consider-using-f-string
name, username
)
)
return ret
__salt__["grafana4.update_org_user"](
Expand Down
1 change: 1 addition & 0 deletions src/saltext/grafana/states/grafana4_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- fullname: Foo Bar
- is_admin: true
"""

import salt.utils.dictupdate as dictupdate
from salt.utils.dictdiffer import deep_diff

Expand Down
17 changes: 9 additions & 8 deletions src/saltext/grafana/states/grafana_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
they exist in dashboards. The module will not manage rows that are not defined,
allowing users to manage their own custom rows.
"""

import copy

import requests
Expand Down Expand Up @@ -150,14 +151,14 @@ def present(
if updated_needed:
if __opts__["test"]:
ret["result"] = None
ret[
"comment"
] = "Dashboard {} is set to be updated, changes={}".format( # pylint: disable=consider-using-f-string
name,
salt.utils.json.dumps(
_dashboard_diff(_cleaned(new_dashboard), _cleaned(old_dashboard)),
indent=4,
),
ret["comment"] = (
"Dashboard {} is set to be updated, changes={}".format( # pylint: disable=consider-using-f-string
name,
salt.utils.json.dumps(
_dashboard_diff(_cleaned(new_dashboard), _cleaned(old_dashboard)),
indent=4,
),
)
)
return ret

Expand Down
1 change: 1 addition & 0 deletions src/saltext/grafana/states/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- basic_auth_password: mypass
- is_default: true
"""

import requests


Expand Down
1 change: 1 addition & 0 deletions tests/unit/states/test_grafana.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
:codeauthor: Jayesh Kariya <[email protected]>
"""

from unittest.mock import MagicMock
from unittest.mock import patch

Expand Down

0 comments on commit b7cb636

Please sign in to comment.