Fix openstack CLI calls environment when using venv

Without this fix the calls to openstack CLI will
return code 2 + error 'No such file or directories'
because the virtual env has not been propagated as
part of the execution PATH

Furthermore this is quite disturbing due to the fact
that some of the failing tasks are marked as
ignore_errors: true.

Change-Id: Iadd3ec14bfd4765488937ea7aa64d296fb129988
This commit is contained in:
Olivier Bourdon 2018-07-04 14:30:19 +02:00
parent 15774c574e
commit 005b91da7f
2 changed files with 22 additions and 0 deletions

View File

@ -16,6 +16,11 @@
# We should likely address that at some point, however I think a user
# should be the driver of that work.
- name: "If VENV is set in the environment, enable installation into venv"
set_fact:
enable_venv: true
when: lookup('env', 'VENV') | length > 0
- name: "Error if credentials are undefined."
fail:
msg: |
@ -119,6 +124,7 @@
no_log: true
register: test_ironic_admin_endpoint
ignore_errors: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Check ironic public endpoint exists"
command: |
@ -133,6 +139,7 @@
no_log: true
register: test_ironic_public_endpoint
ignore_errors: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Check ironic internal endpoint exists"
command: |
@ -147,6 +154,7 @@
no_log: true
register: test_ironic_internal_endpoint
ignore_errors: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Create ironic admin endpoint"
command: |
@ -159,6 +167,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal admin "{{ ironic.keystone.admin_url | default('http://127.0.0.1:6385/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: test_ironic_admin_endpoint.rc != 0 or test_ironic_admin_endpoint.stdout == '[]'
- name: "Create ironic public endpoint"
@ -172,6 +181,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal public "{{ ironic.keystone.public_url | default('http://127.0.0.1:6385/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: test_ironic_public_endpoint.rc != 0 or test_ironic_public_endpoint.stdout == '[]'
- name: "Create ironic internal endpoint"
@ -185,6 +195,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal internal "{{ ironic.keystone.internal_url | default('http://127.0.0.1:6385/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: test_ironic_internal_endpoint.rc != 0 or test_ironic_internal_endpoint.stdout == '[]'
- name: "Create baremetal_admin role"

View File

@ -16,6 +16,11 @@
# We should likely address that at some point, however I think a user
# should be the driver of that work.
- name: "If VENV is set in the environment, enable installation into venv"
set_fact:
enable_venv: true
when: lookup('env', 'VENV') | length > 0
- name: "Error if credentials are undefined."
fail:
msg: |
@ -99,6 +104,7 @@
--region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
no_log: true
register: test_ironic_inspector_admin_endpoint
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Check ironic-inspector public endpoint exists"
command: |
@ -112,6 +118,7 @@
--region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
no_log: true
register: test_ironic_inspector_public_endpoint
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Check ironic-inspector internal endpoint exists"
command: |
@ -125,6 +132,7 @@
--region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
no_log: true
register: test_ironic_inspector_internal_endpoint
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
- name: "Create ironic-inspector admin endpoint"
command: |
@ -137,6 +145,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal-introspection admin "{{ ironic_inspector.keystone.admin_url | default('http://127.0.0.1:5050/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: test_ironic_inspector_admin_endpoint.rc != 0 or test_ironic_inspector_admin_endpoint.stdout == '[]'
# NOTE(TheJulia): This seems like something that should be
@ -153,6 +162,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal-introspection public "{{ ironic_inspector.keystone.public_url | default('http://127.0.0.1:5050/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: test_ironic_inspector_public_endpoint.rc != 0 or test_ironic_inspector_public_endpoint.stdout == '[]'
- name: "Create ironic-inspector internal endpoint"
@ -166,6 +176,7 @@
endpoint create --region "{{ keystone.bootstrap.region_name | default('RegionOne') }}"
baremetal-introspection internal "{{ ironic_inspector.keystone.internal_url | default('http://127.0.0.1:5050/') }}"
no_log: true
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
when: test_ironic_inspector_internal_endpoint.rc != 0 or test_ironic_inspector_internal_endpoint.stdout == '[]'
- name: "Create inspector_user user"