Merge "Quote -e arg in ansible-playbook-command.sh"

This commit is contained in:
Zuul 2021-04-30 01:14:17 +00:00 committed by Gerrit Code Review
commit 68ef653088
1 changed files with 4 additions and 1 deletions

View File

@ -696,7 +696,10 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
for key, value in r_opts['envvars'].items(): for key, value in r_opts['envvars'].items():
f.write('export {}="{}"\n'.format(key, value)) f.write('export {}="{}"\n'.format(key, value))
f.write('echo -e "Running Ansible command"\n') f.write('echo -e "Running Ansible command"\n')
f.write('{} "$@"\n'.format(' '.join(runner_config.command))) args = '{} "$@"\n'.format(' '.join(runner_config.command))
# Single quote the dict passed to -e
args = re.sub('({.*})', '\'\\1\'', args)
f.write(args)
os.chmod(command_path, 0o750) os.chmod(command_path, 0o750)
try: try: