Fix default openstack_deploy dir evaluation

The default is broken because lookup from a missing env var returns
an empty string. Unless the 2nd parameter 'true' is passed to
default, it only defaults undefined variables. An empty string is
not undefined, so the default never works.

In group_vars/all/all.yml, it doesn't matter that the default never
works, because openstack-ansible.rc always sets OSA_CONFIG_DIR.

In get-ansible-role-requirements.yml, it makes a difference, because
the first time this playbook runs during bootstrap,
openstack-ansible.rc will not be loaded yet. This means the default
user roles path is always going to be '/user-role-requirements.yml'
instead of '/etc/openstack_deploy/user-role-requirements.yml'.

Change-Id: Id9e53958daf9494e5baf9cd1e34ed6f83eefa5f4
This commit is contained in:
Logan V 2020-05-17 12:52:15 -05:00
parent c936cf259a
commit e9c33c1c00
2 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@
openstack_release: "{{ lookup('env', 'OSA_VERSION') | default('undefined', true) }}"
## OpenStack Configuration directory
openstack_config_dir: "{{ lookup('env', 'OSA_CONFIG_DIR') | default('/etc/openstack_deploy') }}"
openstack_config_dir: "{{ lookup('env', 'OSA_CONFIG_DIR') | default('/etc/openstack_deploy', true) }}"
## OpenStack Clone directory
openstack_clone_root: "{{ (lookup('env', 'OSA_CLONE_ROOT') | default('/opt/openstack-ansible', true)) }}"

View File

@ -136,6 +136,6 @@
role_file: "{{ playbook_dir }}/../ansible-role-requirements.yml"
role_path_default: '/etc/ansible/roles'
user_roles: "{{ lookup('file', user_role_path, errors='ignore')|default([], true) | from_yaml }}"
user_role_path: "{{ lookup('env', 'OSA_CONFIG_DIR')|default('/etc/openstack_deploy') ~ '/' ~ (user_role_file|default('')) }}"
user_role_path: "{{ lookup('env', 'OSA_CONFIG_DIR') | default('/etc/openstack_deploy', true) ~ '/' ~ (user_role_file|default('')) }}"
git_clone_retries: 2
git_clone_retry_delay: 5