Bugfix/cinder csi cloud config template (#7955)

* Fix invalid condition for username and password inclusion

* Use length filter to test variable conditions
This commit is contained in:
jhchong92 2021-09-10 01:04:11 +08:00 committed by GitHub
parent 60853fa682
commit 83f64a7ff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,31 +1,31 @@
[Global]
auth-url="{{ cinder_auth_url }}"
{% if cinder_application_credential_id is not defined and cinder_application_credential_name is not defined %}
{% if cinder_application_credential_id|length == 0 and cinder_application_credential_name|length == 0 %}
username="{{ cinder_username }}"
password="{{ cinder_password }}"
{% endif %}
{% if cinder_application_credential_id is defined and cinder_application_credential_id != "" %}
{% if cinder_application_credential_id|length > 0 %}
application-credential-id={{ cinder_application_credential_id }}
{% endif %}
{% if cinder_application_credential_name is defined and cinder_application_credential_name != "" %}
{% if cinder_application_credential_name|length > 0 %}
application-credential-name={{ cinder_application_credential_name }}
{% endif %}
{% if cinder_application_credential_secret is defined and cinder_application_credential_secret != "" %}
{% if cinder_application_credential_secret|length > 0 %}
application-credential-secret={{ cinder_application_credential_secret }}
{% endif %}
region="{{ cinder_region }}"
{% if cinder_tenant_id is defined and cinder_tenant_id != "" %}
{% if cinder_tenant_id|length > 0 %}
tenant-id="{{ cinder_tenant_id }}"
{% endif %}
{% if cinder_tenant_name is defined and cinder_tenant_name != "" %}
{% if cinder_tenant_name|length > 0 %}
tenant-name="{{ cinder_tenant_name }}"
{% endif %}
{% if cinder_domain_name is defined and cinder_domain_name != "" %}
{% if cinder_domain_name|length > 0 %}
domain-name="{{ cinder_domain_name }}"
{% elif cinder_domain_id is defined and cinder_domain_id != "" %}
{% elif cinder_domain_id|length > 0 %}
domain-id ="{{ cinder_domain_id }}"
{% endif %}
{% if cinder_cacert is defined and cinder_cacert != "" %}
{% if cinder_cacert|length > 0 %}
ca-file="{{ kube_config_dir }}/cinder-cacert.pem"
{% endif %}