Skip to content

Commit

Permalink
use loop to remove items
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Wollinger committed Apr 19, 2022
1 parent d4af773 commit c6714fc
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions plugins/modules/grafana_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,23 +295,11 @@ def delete_folder(self, folder_uid):
def get_folder_permission(self, folder_uid):
url = "/api/folders/{folder_uid}/permissions".format(folder_uid=folder_uid)
response = self._send_request(url, headers=self.headers, method="GET")
KEYS_TO_REMOVE = ['created', 'inherited', 'slug', 'teamAvatarUrl', 'teamEmail', 'title', 'uid', 'updated', 'url',
'userAvatarUrl', 'userEmail', 'userLogin', 'folderId', 'permissionName', 'team', 'isFolder']
for items in response:
del items['created']
del items['inherited']
del items['slug']
del items['teamAvatarUrl']
del items['teamEmail']
del items['title']
del items['uid']
del items['updated']
del items['url']
del items['userAvatarUrl']
del items['userEmail']
del items['userLogin']
del items['folderId']
del items['permissionName']
del items['team']
del items['isFolder']
for k in KEYS_TO_REMOVE:
del items[k]
if items['userId'] == 0:
del items['userId']
if items['teamId'] == 0:
Expand Down

0 comments on commit c6714fc

Please sign in to comment.