Skip to content
3 changes: 2 additions & 1 deletion src/openstack_workload_generator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions src/openstack_workload_generator/entities/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
from datetime import datetime
from pathlib import Path
from typing import Tuple, Any
import coloredlogs

Expand Down Expand Up @@ -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(
Expand Down