Skip to content

Commit

Permalink
fix(manager): use valid group name when calling groupadd (#566)
Browse files Browse the repository at this point in the history
Use a valid name when creating a new group with `groupadd`, as numbers
are not valid group names.

Closes #561
  • Loading branch information
mdonadoni committed Feb 9, 2024
1 parent 199c163 commit 9493bb2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions reana_workflow_controller/workflow_run_manager.py
Expand Up @@ -27,6 +27,7 @@
REANA_RUNTIME_JOBS_KUBERNETES_NODE_LABEL,
REANA_RUNTIME_KUBERNETES_SERVICEACCOUNT_NAME,
REANA_STORAGE_BACKEND,
WORKFLOW_RUNTIME_GROUP_NAME,
WORKFLOW_RUNTIME_USER_GID,
WORKFLOW_RUNTIME_USER_NAME,
WORKFLOW_RUNTIME_USER_UID,
Expand Down Expand Up @@ -700,8 +701,8 @@ def _create_job_controller_startup_cmd(self, user=None):
"""Create job controller startup cmd."""
base_cmd = "exec flask run -h 0.0.0.0;"
if user:
add_group_cmd = "groupadd -f -g {} {};".format(
WORKFLOW_RUNTIME_USER_GID, WORKFLOW_RUNTIME_USER_GID
add_group_cmd = "getent group '{gid}' || groupadd -f -g '{gid}' '{name}';".format(
gid=WORKFLOW_RUNTIME_USER_GID, name=WORKFLOW_RUNTIME_GROUP_NAME
)
add_user_cmd = "useradd -u {} -g {} -M {};".format(
WORKFLOW_RUNTIME_USER_UID, WORKFLOW_RUNTIME_USER_GID, user
Expand Down

0 comments on commit 9493bb2

Please sign in to comment.