Rename original_basename parameter in various file-related modules

original_basename is a private internal parameter so name it
_original_basename to reflect that it is internal.
This commit is contained in:
Toshio Kuratomi 2018-05-17 07:59:53 -07:00
parent cd4d0069ba
commit 20b9ca6e7c
9 changed files with 45 additions and 58 deletions

View file

@ -134,13 +134,7 @@ class ActionModule(ActionBase):
for opt in ['remote_src', 'regexp', 'delimiter', 'ignore_hidden', 'decrypt']:
if opt in new_module_args:
del new_module_args[opt]
new_module_args.update(
dict(
dest=dest,
original_basename=os.path.basename(src),
)
)
new_module_args['dest'] = dest
if path_checksum != dest_stat['checksum']:

View file

@ -39,7 +39,7 @@ from ansible.utils.hashing import checksum
# Supplement the FILE_COMMON_ARGUMENTS with arguments that are specific to file
# FILE_COMMON_ARGUMENTS contains things that are not arguments of file so remove those as well
REAL_FILE_ARGS = frozenset(FILE_COMMON_ARGUMENTS.keys()).union(
('state', 'path', 'original_basename', 'recurse', 'force',
('state', 'path', '_original_basename', 'recurse', 'force',
'_diff_peek', 'src')).difference(
('content', 'decrypt', 'backup', 'remote_src', 'regexp', 'delimiter',
'directory_mode', 'unsafe_writes'))
@ -304,7 +304,7 @@ class ActionModule(ActionBase):
dict(
src=tmp_src,
dest=dest,
original_basename=source_rel,
_original_basename=source_rel,
follow=follow
)
)
@ -338,7 +338,7 @@ class ActionModule(ActionBase):
new_module_args.update(
dict(
dest=dest,
original_basename=source_rel,
_original_basename=source_rel,
recurse=False,
state='file',
)

View file

@ -90,33 +90,19 @@ class ActionModule(ActionBase):
# handle diff mode client side
# handle check mode client side
if not remote_src:
# fix file permissions when the copy is done as a different user
self._fixup_perms2((self._connection._shell.tmpdir, tmp_src))
# Build temporary module_args.
new_module_args = self._task.args.copy()
new_module_args.update(
dict(
src=tmp_src,
original_basename=os.path.basename(source),
),
)
else:
new_module_args = self._task.args.copy()
new_module_args.update(
dict(
original_basename=os.path.basename(source),
),
)
# remove action plugin only key
# remove action plugin only keys
new_module_args = self._task.args.copy()
for key in ('decrypt',):
if key in new_module_args:
del new_module_args[key]
# execute the unarchive module now, with the updated args
result.update(self._execute_module(module_args=new_module_args, task_vars=task_vars))
if not remote_src:
# fix file permissions when the copy is done as a different user
self._fixup_perms2((self._connection._shell.tmpdir, tmp_src))
new_module_args['src'] = tmp_src
# execute the unarchive module now, with the updated args
result.update(self._execute_module(module_args=new_module_args, task_vars=task_vars))
except AnsibleAction as e:
result.update(e.result)
finally:

View file

@ -274,7 +274,7 @@ class ActionModule(ActionBase):
dict(
dest=dest,
src=tmp_src,
original_basename=source_rel,
_original_basename=source_rel,
_copy_mode="single"
)
)