forked from pulp/pulp-oci-images
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split up some responsabilities from the entrypoint to a service conta…
…iner. Closes pulp#544
- Loading branch information
Showing
8 changed files
with
117 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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 | ||
set -x | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
import time | ||
from django.core.exceptions import AppRegistryNotReady | ||
from django.db import connection | ||
from django.db.migrations.executor import MigrationExecutor | ||
|
||
|
||
def is_database_synced(): | ||
connection.prepare_database() | ||
executor = MigrationExecutor(connection) | ||
targets = executor.loader.graph.leaf_nodes() | ||
return not executor.migration_plan(targets) | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
print("Waiting for migrations to be done...") | ||
for _ in range(100): | ||
try: | ||
print("Migrations not done yet") | ||
if is_database_synced(): | ||
break | ||
time.sleep(3) | ||
except AppRegistryNotReady: | ||
print("AppRegistryNotReady") | ||
time.sleep(3) | ||
|
||
print("Migrations applied.") | ||
sys.exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters