diff --git a/src/openstack_workload_generator/__main__.py b/src/openstack_workload_generator/__main__.py index 8b22c94..3c73163 100644 --- a/src/openstack_workload_generator/__main__.py +++ b/src/openstack_workload_generator/__main__.py @@ -70,7 +70,8 @@ type=str, default="default.yaml", help="The config file for environment creation, define a path to the" - " yaml file or a subpath in the profiles folder", + " yaml file or a subpath in the profiles folder of the tool " + "(you can overload the search path by setting the OPENSTACK_WORKLOAD_MANAGER_PROFILES environment variable)", ) exclusive_group_domain = parser.add_mutually_exclusive_group(required=True) diff --git a/src/openstack_workload_generator/entities/helpers.py b/src/openstack_workload_generator/entities/helpers.py index 8df63c7..d9866ca 100644 --- a/src/openstack_workload_generator/entities/helpers.py +++ b/src/openstack_workload_generator/entities/helpers.py @@ -3,6 +3,7 @@ import os import sys from datetime import datetime +from pathlib import Path from typing import Tuple, Any import coloredlogs @@ -66,6 +67,18 @@ def load_config(config_file: str): + f"/../../../profiles/{config_file}" ) + if os.getenv("OPENSTACK_WORKLOAD_MANAGER_PROFILES", None): + potential_profile_file = str( + Path( + os.getenv("OPENSTACK_WORKLOAD_MANAGER_PROFILES", "NONE") + ) # satisfy type-check + / Path(config_file) + ) + LOGGER.info( + "Environment variable OPENSTACK_WORKLOAD_MANAGER_PROFILES set," + f" searching for potential {potential_profile_file}" + ) + if os.path.exists(config_file): Config._file = config_file elif not str(config_file).startswith("/") and os.path.exists(