Check if the HOME env var is set, otherwise use a default

This patch adds code to check if the env var HOME is set,
otherwise uses a default value

Change-Id: I8b1de9f41ba77c8026321bc9e67a951db32745f4
This commit is contained in:
Victoria Martinez de la Cruz
2025-04-03 09:58:04 +00:00
parent cda93078a0
commit 49e2647f47

View File

@@ -20,8 +20,11 @@ import yaml
from observabilityclient.prometheus_client import PrometheusAPIClient from observabilityclient.prometheus_client import PrometheusAPIClient
DEFAULT_CONFIG_LOCATIONS = [os.environ["HOME"] + "/.config/openstack/", DEFAULT_CONFIG_LOCATIONS = (
"/etc/openstack/"] [os.path.join(os.environ["HOME"], ".config/openstack/"), "/etc/openstack/"]
if "HOME" in os.environ
else ["/etc/openstack/"]
)
CONFIG_FILE_NAME = "prometheus.yaml" CONFIG_FILE_NAME = "prometheus.yaml"
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)