files/file.py: Raise an IOError when trying to touch a file with missing intermediate directories within it's path (#33765)

Fixes #33744

Signed-off-by: Patrick Ringl <patrick_@freenet.de>
This commit is contained in:
pari- 2017-12-12 09:48:55 +01:00 committed by Martin Krizek
parent 3abc2cc968
commit dd2ea8ae1d

View file

@ -440,7 +440,7 @@ def main():
if prev_state == 'absent':
try:
open(b_path, 'wb').close()
except OSError as e:
except (OSError, IOError) as e:
module.fail_json(path=path, msg='Error, could not touch target: %s' % to_native(e, nonstring='simplerepr'))
elif prev_state in ('file', 'directory', 'hard'):
try: