The kayobe-env script does not update the KOLLA_SOURCE_PATH and
KOLLA_VENV_PATH variables if they are already set. This can lead to
dangerous and difficult to diagnose issues where Kayobe uses a different
version of Kolla Ansible than expected.
This change updates these variables each time the kayobe-env script is
sourced.
Change-Id: I3b4b0b611750b9c7846ff5f74554aee2f14939e4
Closes-Bug: #2036711
If using separate branches for each environment, it can be useful to
read the environment name from a file committed to each branch. Or, if
sharing the same branch for all environments, it can be useful to set
the default environment to one with lower impact, e.g. dev or staging.
If no --environment option is specified and a .environment file exists
at the root of the directory, use its content as KAYOBE_ENVIRONMENT.
Change-Id: I22b2b466e47a3b4d96931d754a4de7544f0ada5d
The kayobe-env script would try accessing $1 which is an unbound
variable if no argument is passed. This fails when `set -u` is set.
Also refactor usage output into a function. As a side effect, a missing
argument to --environment now causes the script to properly exit with an
error.
Change-Id: I9a44578196086ec24de80b992fed385826778feb