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

reviewable/pr18780/r1
Bruce Pennypacker 12 years ago
parent 88d9145235
commit 5af9543b75

@ -55,12 +55,17 @@ def main():
try:
st = os.stat(path)
except OSError, e:
if e.errno == errno.ENOENT:
d = { 'exists' : False }
module.exit_json(changed=False, stat=d)
module.fail_json(msg = e.strerror)
mode = st.st_mode
# back to ansible
d = {
'exists' : True,
'mode' : S_IMODE(mode),
'isdir' : S_ISDIR(mode),
'ischr' : S_ISCHR(mode),

Loading…
Cancel
Save