mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
now captures any exceptions when trying to create directories
This commit is contained in:
parent
54b02ee0da
commit
e4dd0d98d4
1 changed files with 24 additions and 20 deletions
|
@ -271,6 +271,8 @@ def main():
|
|||
module.exit_json(changed=True)
|
||||
changed = True
|
||||
curpath = ''
|
||||
|
||||
try:
|
||||
# Split the path so we can apply filesystem attributes recursively
|
||||
# from the root (/) directory for absolute paths or the base path
|
||||
# of a relative path. We can then walk the appropriate directory
|
||||
|
@ -291,6 +293,8 @@ def main():
|
|||
tmp_file_args = file_args.copy()
|
||||
tmp_file_args['path']=curpath
|
||||
changed = module.set_fs_attributes_if_different(tmp_file_args, changed)
|
||||
except Exception, e:
|
||||
module.fail_json(path=path, msg='There was an issue creating %s as requested: %s' % (curpath, str(e)))
|
||||
|
||||
# We already know prev_state is not 'absent', therefore it exists in some form.
|
||||
elif prev_state != 'directory':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue