1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

now when making multiple dirs in path to make dir, same permissions are assigned (but only for NEW dirs)

Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
This commit is contained in:
Brian Coca 2014-04-23 10:38:38 -04:00
parent 0af8ca3fee
commit f079d022a3

View file

@ -165,8 +165,15 @@ def main():
if prev_state == 'absent':
if module.check_mode:
module.exit_json(changed=True)
os.makedirs(path)
changed = True
curpath = ''
for dirname in path.split('/'):
curpath = '/'.join([curpath, dirname])
if not os.path.exists(curpath):
os.mkdir(curpath)
tmp_file_args = file_args.copy()
tmp_file_args['path']=curpath
changed = module.set_fs_attributes_if_different(tmp_file_args, changed)
changed = module.set_fs_attributes_if_different(file_args, changed)