mirror of https://github.com/ansible/ansible.git
fix setting config with DOCKER_CONFIG_FILE (#23096)
Fixes #23095 Fixed issue preventing a caller from setting a docker configuration file (e.g. docker.yml) by specifing the config file path in the `DOCKER_CONFIG_FILE` environment variable. Previously, the cli argument parser set a default value for the `--config-file` argument which would prevent ever checking the environment variable, regardless of whether or not the `--config-file` argument even specified a valid file. This commit adds a global `DEFAULT_DOCKER_CONFIG_FILE` variable, which points to the current default `docker.yml` config in the contrib/inventory directory. Now, when this script is called from the command line, the config file passed with the cli `--config-file` arg will be given the highest precedence; if it is absent, this script will then check if the `DOCKER_CONFIG_FILE` env var is set, and load the config file specified if possible. If neither the environment variable or cli argument are specified, then the script will attempt to parse the config file `docker.yml` in this script's directory (if present). If either the `DOCKER_CONFIG_FILE` environment variable or the `--config-file` argument are given but point to a nonexistant file, then the script will print an error message and exit with an error code. It is *not* an error condition if the fallback `docker.yml` does not exist.pull/47552/head
parent
4572d9ccd7
commit
77d73808e6
Loading…
Reference in New Issue