diff --git a/tasks.py b/tasks.py index 36286526b..163699d1d 100644 --- a/tasks.py +++ b/tasks.py @@ -1,4 +1,5 @@ """Development Tasks.""" + from distutils.util import strtobool from time import sleep import os @@ -245,11 +246,11 @@ def import_nautobot_data(context): @task def db_export(context): """Export the database from the dev environment to nautobot.sql.""" - docker_compose(context, "up -d postgres") + docker_compose(context, "up -d db") sleep(2) # Wait for the database to be ready print("Exporting the database as an SQL dump...") - export_cmd = 'exec postgres sh -c "pg_dump -h localhost -d \${NAUTOBOT_DB_NAME} -U \${NAUTOBOT_DB_USER} > /tmp/nautobot.sql"' # noqa: W605 pylint: disable=anomalous-backslash-in-string + export_cmd = 'exec db sh -c "pg_dump -h localhost -d \${NAUTOBOT_DB_NAME} -U \${NAUTOBOT_DB_USER} > /tmp/nautobot.sql"' # noqa: W605 pylint: disable=anomalous-backslash-in-string docker_compose(context, export_cmd, pty=True) copy_cmd = f"docker cp {context.nautobot_docker_compose.project_name}_postgres_1:/tmp/nautobot.sql dev/nautobot.sql" @@ -263,7 +264,7 @@ def db_import(context): print("Importing Database into Development...\n") print("Starting Postgres for DB import...\n") - docker_compose(context, "up -d postgres") + docker_compose(context, "up -d db") sleep(2) print("Copying DB Dump to DB container...\n") @@ -271,5 +272,5 @@ def db_import(context): context.run(copy_cmd) print("Importing DB...\n") - import_cmd = 'exec postgres sh -c "psql -h localhost -U \${NAUTOBOT_DB_USER} < /tmp/nautobot.sql"' # noqa: W605 pylint: disable=anomalous-backslash-in-string + import_cmd = 'exec db sh -c "psql -h localhost -U \${NAUTOBOT_DB_USER} < /tmp/nautobot.sql"' # noqa: W605 pylint: disable=anomalous-backslash-in-string docker_compose(context, import_cmd, pty=True)