Skip to content
Permalink
Browse files

Fix for foreman get_user_roles.

If user had no "Default role" an exception is raised.
Checking for existing key on foreman response.
Also reduced the amount for aiohttp semaphores.

Change-Id: Ifdc8363b22b4a343dad101f48e478d870855dbfe
  • Loading branch information...
grafuls committed Sep 2, 2019
1 parent 3515667 commit 78a9fee1064590f4676563b3457ac81b064d0fd6
Showing with 3 additions and 2 deletions.
  1. +3 −2 quads/tools/foreman.py
@@ -22,7 +22,7 @@ def __init__(self, url, username, password, loop=None):
else:
self.loop = loop
self.new_loop = False
self.semaphore = asyncio.Semaphore(50)
self.semaphore = asyncio.Semaphore(20)

def __exit__(self):
if self.new_loop:
@@ -383,5 +383,6 @@ def __exit__(self):
async def get_user_roles(self, user_id):
endpoint = "/users/%s/roles" % user_id
result = await self.get_obj_dict(endpoint)
result.pop("Default role")
if result.get("Default role", False):
result.pop("Default role")
return [role["id"] for _, role in result.items()]

0 comments on commit 78a9fee

Please sign in to comment.
You can’t perform that action at this time.