catch unicodedecodeerror

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
remotes/origin/feature_files_export
Nico Schottelius 13 years ago
parent c64ab97f2a
commit ad1e51cb2e
  1. 9
      lib/cdist/exec/remote.py

@ -40,6 +40,13 @@ class RemoteScriptError(cdist.Error):
def __str__(self):
return "Remote script execution failed: %s %s" % (self.script, self.command)
class DecodeError(cdist.Error):
def __init__(self, command):
self.command = command
def __str__(self):
return "Cannot decode output of " + " ".join(self.command)
class Remote(object):
"""Execute commands remotely.
@ -121,6 +128,8 @@ class Remote(object):
raise cdist.Error("Command failed: " + " ".join(command))
except OSError as error:
raise cdist.Error(" ".join(*args) + ": " + error.args[1])
except UnicodeDecodeError:
raise DecodeError(command)
def run_script(self, script, env=None, return_output=False):
"""Run the given script with the given environment on the remote side.

Loading…
Cancel
Save