Skip to content

Commit

Permalink
Fix api-moduled startup error
Browse files Browse the repository at this point in the history
This change catches the 403 (Forbidden) error from api-server: just log
a warning for it.

To permanently fix the problem, the core must grant list-modules to
accountprovider role.
  • Loading branch information
DavidePrincipi committed Jan 25, 2024
1 parent 505962a commit a35b55e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions imageroot/bin/write-user-portal-config
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ with agent.redis_connect(use_replica=True) as rdb:
modules_set.add(key.rstrip('0123456789'))

# Translate the image identifiers in module_set into human readable strings
response = agent.tasks.run(agent_id='cluster', action='list-modules', data=None)
names_set=set()
for item in response['output']:
if item.get('id') in modules_set:
names_set.add(item.get('name'))
try:
response = agent.tasks.run(agent_id='cluster', action='list-modules', data=None)
for item in response['output']:
if item.get('id') in modules_set:
names_set.add(item.get('name'))
except Exception as ex:
print(agent.SD_WARNING + "Failed to run cluster/list-modules action:", ex, file=sys.stderr)

# Write modules set to a JSON file
data = {"domain": realm, "services": list(names_set)}
Expand Down

0 comments on commit a35b55e

Please sign in to comment.