Quote variables that might contain special chars

The username/passwords might contain characters that need to be properly
quoted when being passed to the tripleoclient.

Change-Id: I677a99e3adc1cde8dc8cd6515513ec5e900fdab5
This commit is contained in:
Alex Schultz 2020-02-05 13:50:37 -07:00
parent 360d681e7a
commit 6348f14472
4 changed files with 16 additions and 16 deletions

View File

@ -4,8 +4,8 @@
set_fact:
_delete_cmd: >-
{{ openstack_bin }} tripleo container image delete
{{ tripleo_container_image_delete_username | ternary('--username $TRIPLEO_IMAGE_DELETE_USERNAME', '') }}
{{ tripleo_container_image_delete_password | ternary('--password $TRIPLEO_IMAGE_DELETE_PASSWORD', '') }}
{{ tripleo_container_image_delete_username | ternary('--username "$TRIPLEO_IMAGE_DELETE_USERNAME"', '') }}
{{ tripleo_container_image_delete_password | ternary('--password "$TRIPLEO_IMAGE_DELETE_PASSWORD"', '') }}
{{ tripleo_container_image_delete_registry_url | ternary('--registry-url $TRIPLEO_IMAGE_DELETE_REGISTRY_URL', '') }}
{{ tripleo_container_image_delete_yes | ternary('--yes', '') }}
{{ tripleo_container_image_delete_image }}
@ -18,8 +18,8 @@
- name: Container image delete
shell: "{{ _delete_cmd }}" # noqa 305
environment:
TRIPLEO_IMAGE_DELETE_USERNAME: "{{ tripleo_container_image_delete_username | default('') }}"
TRIPLEO_IMAGE_DELETE_PASSWORD: "{{ tripleo_container_image_delete_password | default('') }}"
TRIPLEO_IMAGE_DELETE_USERNAME: "{{ tripleo_container_image_delete_username | default('') | quote }}"
TRIPLEO_IMAGE_DELETE_PASSWORD: "{{ tripleo_container_image_delete_password | default('') | quote }}"
TRIPLEO_IMAGE_DELETE_REGISTRY_URL: "{{ tripleo_container_image_delete_registry_url | default('') }}"
become: "{{ tripleo_container_image_delete_become }}"
register: tripleo_container_image_delete_result

View File

@ -4,8 +4,8 @@
set_fact:
_list_cmd: >-
{{ openstack_bin }} tripleo container image list
{{ tripleo_container_image_list_username | ternary('--username $TRIPLEO_IMAGE_LIST_USERNAME', '') }}
{{ tripleo_container_image_list_password | ternary('--password $TRIPLEO_IMAGE_LIST_PASSWORD', '') }}
{{ tripleo_container_image_list_username | ternary('--username "$TRIPLEO_IMAGE_LIST_USERNAME"', '') }}
{{ tripleo_container_image_list_password | ternary('--password "$TRIPLEO_IMAGE_LIST_PASSWORD"', '') }}
{{ tripleo_container_image_list_registry_url | ternary('--registry-url $TRIPLEO_IMAGE_LIST_REGISTRY_URL', '') }}
{{ tripleo_container_image_list_format | ternary('-f $TRIPLEO_IMAGE_LIST_FORMAT', '') }}
@ -17,8 +17,8 @@
- name: Container image list
shell: "{{ _list_cmd }}" # noqa 305
environment:
TRIPLEO_IMAGE_LIST_USERNAME: "{{ tripleo_container_image_list_username | default('') }}"
TRIPLEO_IMAGE_LIST_PASSWORD: "{{ tripleo_container_image_list_password | default('') }}"
TRIPLEO_IMAGE_LIST_USERNAME: "{{ tripleo_container_image_list_username | default('') | quote }}"
TRIPLEO_IMAGE_LIST_PASSWORD: "{{ tripleo_container_image_list_password | default('') | quote }}"
TRIPLEO_IMAGE_LIST_REGISTRY_URL: "{{ tripleo_container_image_list_registry_url | default('') }}"
TRIPLEO_IMAGE_LIST_FORMAT: "{{ tripleo_container_image_list_format | default('') }}"
register: tripleo_container_image_list_result

View File

@ -5,8 +5,8 @@
_push_cmd: >-
{{ openstack_bin }} tripleo container image push
{{ tripleo_container_image_push_local | ternary('--local', '') }}
{{ tripleo_container_image_push_username | ternary('--username $TRIPLEO_IMAGE_PUSH_USERNAME', '') }}
{{ tripleo_container_image_push_password | ternary('--password $TRIPLEO_IMAGE_PUSH_PASSWORD', '') }}
{{ tripleo_container_image_push_username | ternary('--username "$TRIPLEO_IMAGE_PUSH_USERNAME"', '') }}
{{ tripleo_container_image_push_password | ternary('--password "$TRIPLEO_IMAGE_PUSH_PASSWORD"', '') }}
{{ tripleo_container_image_push_registry_url | ternary('--registry-url $TRIPLEO_IMAGE_PUSH_REGISTRY_URL', '') }}
{{ tripleo_container_image_push_append_tag | ternary('--append-tag $TRIPLEO_IMAGE_PUSH_APPEND_TAG', '') }}
{{ tripleo_container_image_push_dry_run | ternary('--dry-run', '') }}
@ -23,8 +23,8 @@
shell: "{{ _push_cmd }}" # noqa 305
environment:
TRIPLEO_IMAGE_PUSH_APPEND_TAG: "{{ tripleo_container_image_push_append_tag | default('') }}"
TRIPLEO_IMAGE_PUSH_USERNAME: "{{ tripleo_container_image_push_username | default('') }}"
TRIPLEO_IMAGE_PUSH_PASSWORD: "{{ tripleo_container_image_push_password | default('') }}"
TRIPLEO_IMAGE_PUSH_USERNAME: "{{ tripleo_container_image_push_username | default('') | quote }}"
TRIPLEO_IMAGE_PUSH_PASSWORD: "{{ tripleo_container_image_push_password | default('') | quote }}"
TRIPLEO_IMAGE_PUSH_REGISTRY_URL: "{{ tripleo_container_image_push_registry_url | default('') }}"
async: "{{ tripleo_container_image_push_timeout }}"
poll: 1

View File

@ -4,8 +4,8 @@
set_fact:
_show_cmd: >-
{{ openstack_bin }} tripleo container image show
{{ tripleo_container_image_show_username | ternary('--username $TRIPLEO_IMAGE_SHOW_USERNAME', '') }}
{{ tripleo_container_image_show_password | ternary('--password $TRIPLEO_IMAGE_SHOW_PASSWORD', '') }}
{{ tripleo_container_image_show_username | ternary('--username "$TRIPLEO_IMAGE_SHOW_USERNAME"', '') }}
{{ tripleo_container_image_show_password | ternary('--password "$TRIPLEO_IMAGE_SHOW_PASSWORD"', '') }}
{{ tripleo_container_image_show_format | ternary('-f $TRIPLEO_IMAGE_SHOW_FORMAT', '') }}
{{ tripleo_container_image_show_image }}
@ -17,8 +17,8 @@
- name: Container image show
shell: "{{ _show_cmd }}" # noqa 305
environment:
TRIPLEO_IMAGE_SHOW_USERNAME: "{{ tripleo_container_image_show_username | default('') }}"
TRIPLEO_IMAGE_SHOW_PASSWORD: "{{ tripleo_container_image_show_password | default('') }}"
TRIPLEO_IMAGE_SHOW_USERNAME: "{{ tripleo_container_image_show_username | default('') | quote }}"
TRIPLEO_IMAGE_SHOW_PASSWORD: "{{ tripleo_container_image_show_password | default('') | quote }}"
TRIPLEO_IMAGE_SHOW_FORMAT: "{{ tripleo_container_image_show_format | default('') }}"
register: tripleo_container_image_show_result
changed_when: false