jjb: xci: xci-run-functest.sh: Ensure env vars are quoted during reload 61/55561/1
authorMarkos Chandras <mchandras@suse.de>
Thu, 12 Apr 2018 10:15:17 +0000 (11:15 +0100)
committerMarkos Chandras <mchandras@suse.de>
Thu, 12 Apr 2018 10:19:13 +0000 (11:19 +0100)
The output of the 'env' command does not use quotes when printing the
env variables so trying to source the xci.env file will lead to problems like
the following one:

/home/devuser/releng-xci/.cache/xci.env: line 17: PROFILEREAD: readonly variable
/home/devuser/releng-xci/.cache/xci.env: line 20: 50340: command not found
/home/devuser/releng-xci/.cache/xci.env: line 40: controller00: command not found
/home/devuser/releng-xci/.cache/xci.env: line 48: on: command not found
/home/devuser/releng-xci/.cache/xci.env: line 55: Francisco/O=IT/CN=xci.releng.opnfv.org: No such file or directory
/home/devuser/releng-xci/.cache/xci.env: line 75: a: command not found
/home/devuser/releng-xci/.cache/xci.env: line 88: -I: command not found
/home/devuser/releng-xci/.cache/xci.env: line 90: 50340: command not found
/home/devuser/releng-xci/.cache/xci.env: line 92: -e: command not found
/home/devuser/releng-xci/.cache/xci.env: line 95: fg: no job control
/home/devuser/releng-xci/.cache/xci.env: line 101: fg: no job control

As such, we need to ensure that variables are properly quoted when
exported.

Change-Id: Ie98d8c921bae849d6bffd3858f67708f417b1d0f
Signed-off-by: Markos Chandras <mchandras@suse.de>
jjb/xci/xci-run-functest.sh

index 3ae6a8d..fad2d7b 100755 (executable)
@@ -47,7 +47,7 @@ fi
 export XCI_PATH=/home/devuser/releng-xci
 export XCI_VENV=${XCI_PATH}/venv
 
-ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm "source $XCI_VENV/bin/activate; source ${XCI_PATH}/.cache/xci.env && cd releng-xci/xci && ansible-playbook -i installer/osa/files/$XCI_FLAVOR/inventory playbooks/prepare-functest.yml"
+ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm "source $XCI_VENV/bin/activate; while read var; do declare -x \"${var}\" 2>/dev/null; done < ${XCI_PATH}/.cache/xci.env && cd releng-xci/xci && ansible-playbook -i installer/osa/files/$XCI_FLAVOR/inventory playbooks/prepare-functest.yml"
 echo "Running functest"
 ssh -F $HOME/.ssh/${DISTRO}-xci-vm-config ${DISTRO}_xci_vm_opnfv "/root/run-functest.sh"
 # Record exit code