unified calls to fs function vs duplicate functions for file and

directory
This commit is contained in:
Brian Coca 2014-03-18 22:39:45 -04:00
parent adc4ecb279
commit ac14a8d6ad
7 changed files with 8 additions and 8 deletions

View file

@ -192,7 +192,7 @@ def main():
os.remove(path) os.remove(path)
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)
changed = module.set_file_attributes_if_different(file_args, changed) changed = module.set_fs_attributes_if_different(file_args, changed)
# Mission complete # Mission complete
module.exit_json(src=src, dest=dest, md5sum=pathmd5, changed=changed, msg="OK") module.exit_json(src=src, dest=dest, md5sum=pathmd5, changed=changed, msg="OK")

View file

@ -123,7 +123,7 @@ def adjust_recursive_directory_permissions(pre_existing_dir, new_directory_list,
if len(new_directory_list) > 0: if len(new_directory_list) > 0:
working_dir = os.path.join(pre_existing_dir, new_directory_list.pop(0)) working_dir = os.path.join(pre_existing_dir, new_directory_list.pop(0))
directory_args['path'] = working_dir directory_args['path'] = working_dir
changed = module.set_directory_attributes_if_different(directory_args, changed) changed = module.set_fs_attributes_if_different(directory_args, changed)
changed = adjust_recursive_directory_permissions(working_dir, new_directory_list, module, directory_args, changed) changed = adjust_recursive_directory_permissions(working_dir, new_directory_list, module, directory_args, changed)
return changed return changed
@ -224,7 +224,7 @@ def main():
module.params['dest'] = dest module.params['dest'] = dest
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)
res_args['changed'] = module.set_file_attributes_if_different(file_args, res_args['changed']) res_args['changed'] = module.set_fs_attributes_if_different(file_args, res_args['changed'])
module.exit_json(**res_args) module.exit_json(**res_args)

View file

@ -179,7 +179,7 @@ def main():
changed = do_ini(module, dest, section, option, value, state, backup) changed = do_ini(module, dest, section, option, value, state, backup)
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)
changed = module.set_file_attributes_if_different(file_args, changed) changed = module.set_fs_attributes_if_different(file_args, changed)
# Mission complete # Mission complete
module.exit_json(dest=dest, changed=changed, msg="OK") module.exit_json(dest=dest, changed=changed, msg="OK")

View file

@ -167,7 +167,7 @@ def write_changes(module,lines,dest):
def check_file_attrs(module, changed, message): def check_file_attrs(module, changed, message):
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)
if module.set_file_attributes_if_different(file_args, False): if module.set_fs_attributes_if_different(file_args, False):
if changed: if changed:
message += " and " message += " and "

View file

@ -293,7 +293,7 @@ def main():
module.params['path'] = dest module.params['path'] = dest
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)
file_args['path'] = dest file_args['path'] = dest
changed = module.set_file_attributes_if_different(file_args, changed) changed = module.set_fs_attributes_if_different(file_args, changed)
# Mission complete # Mission complete
module.exit_json(url=url, dest=dest, src=tmpsrc, md5sum=md5sum_src, module.exit_json(url=url, dest=dest, src=tmpsrc, md5sum=md5sum_src,

View file

@ -414,7 +414,7 @@ def main():
module.params['path'] = dest module.params['path'] = dest
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)
file_args['path'] = dest file_args['path'] = dest
changed = module.set_file_attributes_if_different(file_args, changed) changed = module.set_fs_attributes_if_different(file_args, changed)
resp['path'] = dest resp['path'] = dest
else: else:
changed = False changed = False

View file

@ -163,7 +163,7 @@ def absent(dest, username, check_mode):
def check_file_attrs(module, changed, message): def check_file_attrs(module, changed, message):
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)
if module.set_file_attributes_if_different(file_args, False): if module.set_fs_attributes_if_different(file_args, False):
if changed: if changed:
message += " and " message += " and "