diff options
| author | Matthew Bruzek <matthew.bruzek@canonical.com> | 2015-12-16 14:22:02 -0600 |
|---|---|---|
| committer | Matthew Bruzek <matthew.bruzek@canonical.com> | 2015-12-16 14:22:02 -0600 |
| commit | 96f88c4a94308608a0108d9677b25ba47340e09f (patch) | |
| tree | 1fb1256277d71424b41890612316e226d834fa43 /actions | |
| parent | 031b757bd1419519883ebf3579eb147b09a795e2 (diff) | |
| parent | 860496806328ac8ddddea0402b90a1af17c57284 (diff) | |
[everlast] The dump action was not working. Now it works and if args has spaces, they can be escaped with quotes.
Diffstat (limited to 'actions')
| -rw-r--r-- | actions/backup.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/actions/backup.py b/actions/backup.py index c5a60e2..ac7c4d9 100644 --- a/actions/backup.py +++ b/actions/backup.py @@ -1,3 +1,4 @@ +import shlex import subprocess import os try: @@ -14,7 +15,7 @@ def mkdir(dir): def execute(command, current_working_directory): return subprocess.check_output( - " ".join(command), + shlex.split(command), cwd=current_working_directory, ) @@ -38,7 +39,7 @@ def backup_command(cmd, args, dir): pass # Ignoring, the directory already exists except Exception, e: action_set({"directory creation exception": e}) - action_fail(e) + action_fail(str(e)) return command = cmd + " " + args @@ -50,7 +51,7 @@ def backup_command(cmd, args, dir): except subprocess.CalledProcessError, e: action_set({"error_code": e.returncode, "exception": e, "output": e.output}) - action_fail(e) + action_fail(str(e)) except Exception, e: action_set({"exception": e}) - action_fail(e) + action_fail(str(e)) |
