From ac7134df2b5d07633f6d1c57ac4ac93a65f41f6e Mon Sep 17 00:00:00 2001 From: Justin Drew <2396364+jdrew82@users.noreply.github.com> Date: Wed, 8 May 2024 13:51:34 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Correct=20container=20nam?= =?UTF-8?q?e=20for=20postgres=20to=20be=20db=20in=20task=20commands.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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)