Have a management command to set the admin password using envvar and/or file.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 598
- Forks
- 168
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 86
Description
Right now we have the necessity to check if there's an admin password set and if it's not, set it using the content from a environment variable or from a file.
Currently we have this logic using a shell script:
if [[ -n "$PULP_DEFAULT_ADMIN_PASSWORD" ]]
then
PASSWORD_SET=$(/usr/local/bin/pulpcore-manager shell -c "from django.contrib.auth import get_user_model; print(get_user_model().objects.filter(username=\"admin\").exists())")
if [ "$PASSWORD_SET" = "False" ]
then
/usr/local/bin/pulpcore-manager reset-admin-password --password "${PULP_DEFAULT_ADMIN_PASSWORD}"
fi
else
ADMIN_PASSWORD_FILE=/etc/pulp/pulp-admin-password
if [[ -f "$ADMIN_PASSWORD_FILE" ]]; then
echo "pulp admin can be initialized."
PULP_ADMIN_PASSWORD=$(cat $ADMIN_PASSWORD_FILE)
fi
if [ -n "${PULP_ADMIN_PASSWORD}" ]; then
/usr/local/bin/pulpcore-manager reset-admin-password --password "${PULP_ADMIN_PASSWORD}"
fi
fi
Moving the same logic used above to a management command would allow user from different contexts to use the feature.
Something like: pulpcore-manager set-init-password and then the magic happens.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing reset-admin-password management command and the shell logic shown in the issue. Add a pulpcore-manager set-init-password entry point that checks for the admin user, reads PULP_DEFAULT_ADMIN_PASSWORD or /etc/pulp/pulp-admin-password, and initializes the password only when needed; verify both input paths and the already-initialized case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, shell
- Domain
- authentication, cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100