Commit c47d1214 by Bruce Pennypacker

don't fail if the file doesn't exist. Just set 'exists' to true/false as appropriate

parent 59a045e4
...@@ -55,12 +55,17 @@ def main(): ...@@ -55,12 +55,17 @@ def main():
try: try:
st = os.stat(path) st = os.stat(path)
except OSError, e: except OSError, e:
if e.errno == errno.ENOENT:
d = { 'exists' : False }
module.exit_json(changed=False, stat=d)
module.fail_json(msg = e.strerror) module.fail_json(msg = e.strerror)
mode = st.st_mode mode = st.st_mode
# back to ansible # back to ansible
d = { d = {
'exists' : True,
'mode' : S_IMODE(mode), 'mode' : S_IMODE(mode),
'isdir' : S_ISDIR(mode), 'isdir' : S_ISDIR(mode),
'ischr' : S_ISCHR(mode), 'ischr' : S_ISCHR(mode),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment