Skip to content

Commit

Permalink
manager: run update wrappers always with the operator user (#1620)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt authored Sep 25, 2024
1 parent ca1d521 commit 4842b79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions roles/manager/templates/wrapper/osism-update-docker.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ INSTALL_ANSIBLE_ROLES=${INSTALL_ANSIBLE_ROLES:-true}
VENV_PATH=${VENV_PATH:-.venv}
VENV_PYTHON_BIN=${VENV_PYTHON_BIN:-python3}

if [[ $(whoami) != "{{ operator_user }}" ]]; then
echo "This script must be executed directly with the OSISM operator user {{ operator_user }}."
exit 1
fi

pushd $CONFIGURATION_DIRECTORY/environments/manager > /dev/null

# If the versions for the Ansible collections are available in the manager environment,
Expand Down
5 changes: 5 additions & 0 deletions roles/manager/templates/wrapper/osism-update-manager.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ CONTAINER_IMAGE=${CONTAINER_IMAGE:-osism/seed}
CONTAINER_REGISTRY=${CONTAINER_REGISTRY:-quay.io}
CONTAINER_TAG=${CONTAINER_TAG:-latest}

if [[ $(whoami) != "{{ operator_user }}" ]]; then
echo "This script must be executed directly with the OSISM operator user {{ operator_user }}."
exit 1
fi

if [[ $CONTAINER == "true" ]]; then
docker run --rm -v $CONFIGURATION_DIRECTORY:/opt/configuration:ro -it $CONTAINER_REGISTRY/$CONTAINER_IMAGE:$CONTAINER_TAG $PLAYBOOK
exit 0
Expand Down

0 comments on commit 4842b79

Please sign in to comment.