From e0100341517fa896f7b056b73d4092935cd7cd58 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 31 Jan 2019 16:55:10 -0500 Subject: [PATCH] unquote ev (#51560) * unquote ev * properly test for defined var --- lib/ansible/cli/pull.py | 4 ++-- .../targets/pull/pull-integration-test/local.yml | 6 ++++++ test/integration/targets/pull/runme.sh | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ansible/cli/pull.py b/lib/ansible/cli/pull.py index 5a900b3b7a..715ec2d0a2 100644 --- a/lib/ansible/cli/pull.py +++ b/lib/ansible/cli/pull.py @@ -224,7 +224,7 @@ class PullCLI(CLI): context.CLIARGS['module_name'], repo_opts, limit_opts) for ev in context.CLIARGS['extra_vars']: - cmd += ' -e "%s"' % shlex_quote(ev) + cmd += ' -e %s' % shlex_quote(ev) # Nap? if context.CLIARGS['sleep']: @@ -259,7 +259,7 @@ class PullCLI(CLI): cmd += " --vault-id=%s" % vault_id for ev in context.CLIARGS['extra_vars']: - cmd += ' -e "%s"' % shlex_quote(ev) + cmd += ' -e %s' % shlex_quote(ev) if context.CLIARGS['ask_sudo_pass'] or context.CLIARGS['ask_su_pass'] or context.CLIARGS['become_ask_pass']: cmd += ' --ask-become-pass' if context.CLIARGS['skip_tags']: diff --git a/test/integration/targets/pull/pull-integration-test/local.yml b/test/integration/targets/pull/pull-integration-test/local.yml index f251b43473..3a924fa3fe 100644 --- a/test/integration/targets/pull/pull-integration-test/local.yml +++ b/test/integration/targets/pull/pull-integration-test/local.yml @@ -11,3 +11,9 @@ failed_when: "'testhost1.example.com' == inventory_hostname" - name: final task, has to be reached for the test to succeed debug: msg="MAGICKEYWORD" + + - name: check that extra vars are correclty passed + assert: + that: + - docker_registries_login is defined + tags: ['never', 'test_ev'] diff --git a/test/integration/targets/pull/runme.sh b/test/integration/targets/pull/runme.sh index b53fb45b67..d3632aa794 100755 --- a/test/integration/targets/pull/runme.sh +++ b/test/integration/targets/pull/runme.sh @@ -51,6 +51,6 @@ PASSWORD='test' USER=${USER:-'broken_docker'} JSON_EXTRA_ARGS='{"docker_registries_login": [{ "docker_password": "'"${PASSWORD}"'", "docker_username": "'"${USER}"'", "docker_registry_url":"repository-manager.company.com:5001"}], "docker_registries_logout": [{ "docker_password": "'"${PASSWORD}"'", "docker_username": "'"${USER}"'", "docker_registry_url":"repository-manager.company.com:5001"}] }' -ANSIBLE_CONFIG='' ansible-pull -d "${pull_dir}" -U "${repo_dir}" -e "${JSON_EXTRA_ARGS}" "$@" | tee "${temp_log}" +ANSIBLE_CONFIG='' ansible-pull -d "${pull_dir}" -U "${repo_dir}" -e "${JSON_EXTRA_ARGS}" "$@" --tags untagged,test_ev | tee "${temp_log}" pass_tests