From 723961773d091704462a05732b8d06b120968bad Mon Sep 17 00:00:00 2001 From: Vinicius Date: Mon, 30 Oct 2023 17:33:06 -0300 Subject: [PATCH] using shutil to copy and pathlib to chmod fix #132 --- src/domino/cli/utils/platform.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/domino/cli/utils/platform.py b/src/domino/cli/utils/platform.py index 9fe9d157a..dfad74cdf 100644 --- a/src/domino/cli/utils/platform.py +++ b/src/domino/cli/utils/platform.py @@ -13,6 +13,7 @@ from cryptography.hazmat.backends import default_backend as crypto_default_backend from tempfile import NamedTemporaryFile, TemporaryDirectory from kubernetes import client, config +import shutil from domino.cli.utils.constants import COLOR_PALETTE, DOMINO_HELM_PATH, DOMINO_HELM_VERSION, DOMINO_HELM_REPOSITORY @@ -660,21 +661,23 @@ def run_platform_compose(detached: bool = False, use_config_file: bool = False, local_path = Path(".").resolve() domino_dir = local_path / "domino_data" domino_dir.mkdir(parents=True, exist_ok=True) - subprocess.run(["chmod", "-R", "777", "domino_data"]) + domino_dir.chmod(0o777) + airflow_base = local_path / 'airflow' airflow_logs_dir = local_path / "airflow/logs" airflow_logs_dir.mkdir(parents=True, exist_ok=True) airflow_dags_dir = local_path / "airflow/dags" airflow_dags_dir.mkdir(parents=True, exist_ok=True) airflow_plugins_dir = local_path / "airflow/plugins" airflow_plugins_dir.mkdir(parents=True, exist_ok=True) - subprocess.run(["chmod", "-R", "777", "airflow"]) + airflow_base.chmod(0o777) # Copy docker-compose.yaml file from package to local path if create_database: docker_compose_path = Path(__file__).resolve().parent / "docker-compose.yaml" else: docker_compose_path = Path(__file__).resolve().parent / "docker-compose-without-database.yaml" - subprocess.run(["cp", str(docker_compose_path), "./docker-compose.yaml"]) + + shutil.copy(str(docker_compose_path), "./docker-compose.yaml") # Run docker-compose up cmd = [ "docker",