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 13, 2024
1 parent 4fbdb74 commit 73a9929
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions reana_workflow_controller/workflow_run_manager.py
Original file line number Diff line number Diff line change
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,10 @@ 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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pyrsistent==0.20.0 # via jsonschema
python-dateutil==2.8.2 # via bravado, bravado-core, kubernetes
pytz==2023.3.post1 # via bravado-core
pyyaml==6.0.1 # via bravado, bravado-core, kubernetes, reana-commons, swagger-spec-validator
reana-commons[kubernetes]==0.9.4 # via reana-commons, reana-db, reana-workflow-controller (setup.py)
reana-commons[kubernetes]==0.9.6 # via reana-commons, reana-db, reana-workflow-controller (setup.py)
reana-db==0.9.3 # via reana-workflow-controller (setup.py)
requests==2.25.0 # via bravado, bravado-core, kubernetes, reana-workflow-controller (setup.py), requests-oauthlib
requests-oauthlib==1.3.1 # via kubernetes
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"jsonpickle>=0.9.6",
"marshmallow>2.13.0,<=2.20.1",
"packaging>=18.0",
"reana-commons[kubernetes]>=0.9.4,<0.10.0",
"reana-commons[kubernetes]>=0.9.6,<0.10.0",
"reana-db>=0.9.3,<0.10.0",
"requests==2.25.0",
"sqlalchemy-utils>=0.31.0",
Expand Down

0 comments on commit 73a9929

Please sign in to comment.