diff options
Diffstat (limited to 'cloudinit/execute.py')
-rw-r--r-- | cloudinit/execute.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cloudinit/execute.py b/cloudinit/execute.py new file mode 100644 index 00000000..033da8f7 --- /dev/null +++ b/cloudinit/execute.py @@ -0,0 +1,13 @@ +def run(list,cfg): + import subprocess + retcode = subprocess.call(list) + + if retcode == 0: + return + + if retcode < 0: + str="Cmd terminated by signal %s\n" % -retcode + else: + str="Cmd returned %s\n" % retcode + str+=' '.join(list) + raise Exception(str) |