Remove escape characters from container command

Ansible outputs JSON-encoded strings which does not work with
container clis (ex. docker). Write to a temp file instead.

Change-Id: I554d62265ecf0e890f9545d871afe85c0344f747
Closes-Bug: #1847707
changes/60/687960/3
Rabi Mishra 2019-10-10 23:02:53 +05:30
parent a93849a211
commit 63243f6cb0
1 changed files with 7 additions and 1 deletions

View File

@ -50,6 +50,7 @@
sed 's/--interactive /--volume=\/tmp\/cleanup-{{ item.key }}.sh:\/cleanup.sh:ro /g ' )"
f="/tmp/cleanup-{{ item.key }}.sh"
f_cmd="/tmp/container-cmd-{{ item.key }}.sh"
echo "#!/bin/sh" > $f
echo "set -x" >> $f
@ -61,7 +62,12 @@
echo $cmd /cleanup.sh
$cmd /cleanup.sh
echo "#!/bin/sh" > $f_cmd
echo "set -x" >> $f_cmd
echo "set -e" >> $f_cmd
echo $cmd /cleanup.sh >> $f_cmd
chmod a+x $f_cmd
$f_cmd
fi
with_dict: "{{ agent_cleanups }}"