From 78251b0304f692035d78a0ba4f2be9e9af99cfb2 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Tue, 16 Jun 2020 01:02:03 -0700 Subject: [PATCH] Fix check external_openstack_tenant_name value (#6270) We need to specify either external_openstack_tenant_name or external_openstack_tenant_id. Those values were checked by seeing they are defined or they have actual values separately. However those values are always defined because of the following code of openstack/defaults/main.yml: external_openstack_tenant_id: "{{ lookup('env','OS_TENANT_ID')| default(lookup('env','OS_PROJECT_ID'),true) }}" external_openstack_tenant_name: "{{ lookup('env','OS_TENANT_NAME')| default(lookup('env','OS_PROJECT_NAME'),true) }}" So even if not specifying both values, those checks could not detect the misconfiguration. This fixes this to detect the misconfiguration. --- .../openstack/tasks/openstack-credential-check.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/roles/kubernetes-apps/external_cloud_controller/openstack/tasks/openstack-credential-check.yml b/roles/kubernetes-apps/external_cloud_controller/openstack/tasks/openstack-credential-check.yml index b5a447472..d46bcb626 100644 --- a/roles/kubernetes-apps/external_cloud_controller/openstack/tasks/openstack-credential-check.yml +++ b/roles/kubernetes-apps/external_cloud_controller/openstack/tasks/openstack-credential-check.yml @@ -23,12 +23,5 @@ fail: msg: "one of external_openstack_tenant_id or external_openstack_tenant_name must be specified" when: - - external_openstack_tenant_id is not defined or not external_openstack_tenant_id - - external_openstack_tenant_name is not defined - -- name: External OpenStack Cloud Controller | check external_openstack_tenant_name value - fail: - msg: "one of external_openstack_tenant_id or external_openstack_tenant_name must be specified" - when: - - external_openstack_tenant_name is not defined or not external_openstack_tenant_name - - external_openstack_tenant_id is not defined + - (external_openstack_tenant_id is not defined or not external_openstack_tenant_id) and + (external_openstack_tenant_name is not defined or not external_openstack_tenant_name)