From 00ac26e1e4fa908e499830e873a2c876ddcbf629 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Mon, 29 Jun 2020 16:10:41 +0200 Subject: [PATCH] Fix bifrost_venv_dir default assignment The lookup('env', ...) will assign a value to the vatiable even if the env value is undefined, bypassing the default statement in ansible. We should use 'or' to fix that. Change-Id: I113f5180a17b2cec1e26879003b13c415bbd5c0b --- playbooks/roles/bifrost-create-dib-image/defaults/main.yml | 2 +- playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml | 2 +- playbooks/roles/bifrost-ironic-install/defaults/main.yml | 2 +- playbooks/roles/bifrost-keystone-install/defaults/main.yml | 2 +- playbooks/roles/bifrost-pip-install/defaults/main.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/playbooks/roles/bifrost-create-dib-image/defaults/main.yml b/playbooks/roles/bifrost-create-dib-image/defaults/main.yml index 64b5bf3b8..0bedc43c2 100644 --- a/playbooks/roles/bifrost-create-dib-image/defaults/main.yml +++ b/playbooks/roles/bifrost-create-dib-image/defaults/main.yml @@ -21,7 +21,7 @@ reqs_git_folder: /opt/stack/requirements ipa_builder_git_folder: /opt/stack/ironic-python-agent-builder # Settings related to installing bifrost in a virtual environment enable_venv: true -bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/opt/stack/bifrost') }}" +bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" bifrost_venv_env: VIRTUAL_ENV: "{{ bifrost_venv_dir }}" PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env diff --git a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml index 439ed1c19..2b41a0ba3 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/defaults/main.yml @@ -36,7 +36,7 @@ test_vm_machine: "pc-1.0" test_vm_libvirt_uri: "{{ lookup('env', 'LIBVIRT_CONNECT_URI') | default('qemu:///system', true) }}" # Settings related to installing bifrost in a virtual environment enable_venv: true -bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/opt/stack/bifrost') }}" +bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" bifrost_venv_env: VIRTUAL_ENV: "{{ bifrost_venv_dir }}" PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index 8ce84e001..e7863f9bf 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -241,7 +241,7 @@ download_ipxe: false # Settings related to installing bifrost in a virtual environment enable_venv: true -bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/opt/stack/bifrost') }}" +bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" bifrost_venv_env: VIRTUAL_ENV: "{{ bifrost_venv_dir }}" PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env diff --git a/playbooks/roles/bifrost-keystone-install/defaults/main.yml b/playbooks/roles/bifrost-keystone-install/defaults/main.yml index 997aafb40..3756f22e0 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/main.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/main.yml @@ -36,7 +36,7 @@ http_boot_folder: /httpboot # Settings related to installing bifrost in a virtual environment enable_venv: true -bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/opt/stack/bifrost') }}" +bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" bifrost_venv_env: VIRTUAL_ENV: "{{ bifrost_venv_dir }}" PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env diff --git a/playbooks/roles/bifrost-pip-install/defaults/main.yml b/playbooks/roles/bifrost-pip-install/defaults/main.yml index 2095ecf46..4961ab7c6 100644 --- a/playbooks/roles/bifrost-pip-install/defaults/main.yml +++ b/playbooks/roles/bifrost-pip-install/defaults/main.yml @@ -1,6 +1,6 @@ --- # Global options -bifrost_venv_dir: "{{ lookup('env', 'VENV') | default('/opt/stack/bifrost') }}" +bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" bifrost_venv_env: VIRTUAL_ENV: "{{ bifrost_venv_dir }}" PATH: "{{ bifrost_venv_dir }}/bin:{{ ansible_env.PATH }}" # include regular path via lookup env