From 6348f14472b978ded82e11e6e8fe00ede808f8ed Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Wed, 5 Feb 2020 13:50:37 -0700 Subject: [PATCH] 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 --- roles/tripleo_container_image_delete/tasks/main.yml | 8 ++++---- roles/tripleo_container_image_list/tasks/main.yml | 8 ++++---- roles/tripleo_container_image_push/tasks/main.yml | 8 ++++---- roles/tripleo_container_image_show/tasks/main.yml | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/roles/tripleo_container_image_delete/tasks/main.yml b/roles/tripleo_container_image_delete/tasks/main.yml index 3832e86..31de51f 100644 --- a/roles/tripleo_container_image_delete/tasks/main.yml +++ b/roles/tripleo_container_image_delete/tasks/main.yml @@ -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 diff --git a/roles/tripleo_container_image_list/tasks/main.yml b/roles/tripleo_container_image_list/tasks/main.yml index 808a23a..de51a88 100644 --- a/roles/tripleo_container_image_list/tasks/main.yml +++ b/roles/tripleo_container_image_list/tasks/main.yml @@ -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 diff --git a/roles/tripleo_container_image_push/tasks/main.yml b/roles/tripleo_container_image_push/tasks/main.yml index bd73e24..83d5189 100644 --- a/roles/tripleo_container_image_push/tasks/main.yml +++ b/roles/tripleo_container_image_push/tasks/main.yml @@ -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 diff --git a/roles/tripleo_container_image_show/tasks/main.yml b/roles/tripleo_container_image_show/tasks/main.yml index 79b4e35..22779db 100644 --- a/roles/tripleo_container_image_show/tasks/main.yml +++ b/roles/tripleo_container_image_show/tasks/main.yml @@ -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