Use AnsibleError instead of exit for errors in utils

This commit is contained in:
James Cammarata 2013-08-25 11:46:45 -05:00
parent a8984a6b2b
commit 88966e6558

View file

@ -220,9 +220,9 @@ def prepare_writeable_dir(tree,mode=0777):
try: try:
os.makedirs(tree, mode) os.makedirs(tree, mode)
except (IOError, OSError), e: except (IOError, OSError), e:
exit("Could not make dir %s: %s" % (tree, e)) raise errors.AnsibleError("Could not make dir %s: %s" % (tree, e))
if not os.access(tree, os.W_OK): if not os.access(tree, os.W_OK):
exit("Cannot write to path %s" % tree) raise errors.AnsibleError("Cannot write to path %s" % tree)
return tree return tree
def path_dwim(basedir, given): def path_dwim(basedir, given):