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
1 changed files with 6 additions and 3 deletions

View File

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