Quote ansible command and include config file
One of the useful parts of the executor debug output is that if you have
keep-jobdir flag on and are holding the node you can run the command
again to debug any problems.
Unfortunately you have to include the ANSIBLE_CONFIG file as an env
variable to make this work - and there is no CLI equivalent for
ANSIBLE_CONFIG. Include the config file in the debug output and unquote
the cmd for easier copy and pasting.
Change-Id: If968f8f0c20f0d043653e8c127603b1725875d89
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index 67fc5e6..2ed20bc 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -28,6 +28,7 @@
import gear
import git
+from six.moves import shlex_quote
import zuul.merger.merger
import zuul.ansible.action
@@ -912,14 +913,17 @@
env_copy['LOGNAME'] = 'zuul'
if trusted:
- env_copy['ANSIBLE_CONFIG'] = self.jobdir.trusted_config
+ config_file = self.jobdir.trusted_config
else:
- env_copy['ANSIBLE_CONFIG'] = self.jobdir.untrusted_config
+ config_file = self.jobdir.untrusted_config
+
+ env_copy['ANSIBLE_CONFIG'] = config_file
with self.proc_lock:
if self.aborted:
return (self.RESULT_ABORTED, None)
- self.log.debug("Ansible command: %s" % (cmd,))
+ self.log.debug("Ansible command: ANSIBLE_CONFIG=%s %s",
+ config_file, " ".join(shlex_quote(c) for c in cmd))
self.proc = subprocess.Popen(
cmd,
cwd=self.jobdir.work_root,