From 1e3860c47b6b5e150efd1ece9097c120d4da3272 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 23 Apr 2014 10:38:38 -0400 Subject: [PATCH] now when making multiple dirs in path to make dir, same permissions are assigned (but only for NEW dirs) Signed-off-by: Brian Coca --- files/file | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/files/file b/files/file index 3b4aaa9e235..b10688f2f60 100644 --- a/files/file +++ b/files/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)