From a35b55eb6281174f25644ef24b33c5f2acc9bd5e Mon Sep 17 00:00:00 2001 From: Davide Principi Date: Thu, 25 Jan 2024 09:34:48 +0100 Subject: [PATCH] Fix api-moduled startup error 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. --- imageroot/bin/write-user-portal-config | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/imageroot/bin/write-user-portal-config b/imageroot/bin/write-user-portal-config index edcf1063..35f66762 100755 --- a/imageroot/bin/write-user-portal-config +++ b/imageroot/bin/write-user-portal-config @@ -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)}