summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorTiago Gomes <tiago.gomes@codethink.co.uk>2015-09-01 15:08:49 +0000
committerTiago Gomes <tiago.gomes@codethink.co.uk>2015-09-28 10:00:28 +0000
commit63bb0c9c7edaf3cdaf8d03eb0fbcdbba40b65d36 (patch)
tree83e10287cf5a6197eb9f96334fa51842cd091574 /morphlib
parent7bfee8e0b73c862c7b447dcfb86b3dab317f24f9 (diff)
downloadmorph-63bb0c9c7edaf3cdaf8d03eb0fbcdbba40b65d36.tar.gz
Replace cliapp.shell_quote() with pipes.quote()
Replace cliapp.shell_quote() with pipes.quote() to produce the chroot scripts. Despite pipes.quote() being deprecated, it produces much less escaping than cliapp.shell_quote(). This method should be replaced with shlex.quote() when migrating to Python 3. Change-Id: I4b8e8eefe0cd321458bb3fae72f6d0552680f84f
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/builder.py3
-rw-r--r--morphlib/stagingarea.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py
index a9fe8957..443741b0 100644
--- a/morphlib/builder.py
+++ b/morphlib/builder.py
@@ -25,6 +25,7 @@ import traceback
import subprocess
import tempfile
import warnings
+import pipes
import cliapp
@@ -697,7 +698,7 @@ class SystemBuilder(BuilderBase): # pragma: no cover
with open(chroot_script, 'w') as f:
cmdline = morphlib.util.containerised_cmdline(
shell_command, **container_config)
- f.write(' '.join(map(cliapp.shell_quote, cmdline)))
+ f.write(' '.join(map(pipes.quote, cmdline)))
with open(logfilepath, 'r') as log:
shutil.copyfileobj(log, self.app.output)
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py
index ba2bf39c..6965252d 100644
--- a/morphlib/stagingarea.py
+++ b/morphlib/stagingarea.py
@@ -21,6 +21,7 @@ import cliapp
from urlparse import urlparse
import tempfile
import fcntl
+import pipes
import morphlib
@@ -292,7 +293,7 @@ class StagingArea(object):
cmdline = morphlib.util.containerised_cmdline(
shell_command, **container_config)
with open(chroot_script, 'w') as f:
- f.write(' '.join(map(cliapp.shell_quote, cmdline)))
+ f.write(' '.join(map(pipes.quote, cmdline)))
return exit