handle ioerror if script does not exist

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-09-23 17:19:45 +02:00
parent a2f3246758
commit 91022c3f7e

View file

@ -181,9 +181,12 @@ class Cdist:
if remote: if remote:
remote_cat(script) remote_cat(script)
else: else:
try:
script_fd = open(script) script_fd = open(script)
print(script_fd.read()) print(script_fd.read())
script_fd.close() script_fd.close()
except IOError as error:
raise CdistError(str(error))
raise CdistError("Command failed (shell): " + " ".join(*args)) raise CdistError("Command failed (shell): " + " ".join(*args))
except OSError as error: except OSError as error: