diff options
Diffstat (limited to 'lib/ansible/plugins/action')
-rw-r--r-- | lib/ansible/plugins/action/__init__.py | 64 | ||||
-rw-r--r-- | lib/ansible/plugins/action/assemble.py | 6 | ||||
-rw-r--r-- | lib/ansible/plugins/action/command.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/copy.py | 8 | ||||
-rw-r--r-- | lib/ansible/plugins/action/fetch.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/normal.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/package.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/patch.py | 4 | ||||
-rw-r--r-- | lib/ansible/plugins/action/script.py | 5 | ||||
-rw-r--r-- | lib/ansible/plugins/action/service.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/template.py | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/action/unarchive.py | 6 | ||||
-rw-r--r-- | lib/ansible/plugins/action/win_copy.py | 14 |
13 files changed, 60 insertions, 59 deletions
diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 7ab5be7cd0..0e03713588 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -68,7 +68,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): :kwarg tmp: Deprecated parameter. This is no longer used. An action plugin that calls another one and wants to use the same remote tmp for both should set - self._connection._shell.tempdir rather than this parameter. + self._connection._shell.tmpdir rather than this parameter. :kwarg task_vars: The variables (host vars, group vars, config vars, etc) associated with this task. :returns: dictionary of results from the module @@ -82,8 +82,8 @@ class ActionBase(with_metaclass(ABCMeta, object)): if tmp is not None: result['warning'] = ['ActionModule.run() no longer honors the tmp parameter. Action' - ' plugins should set self._connection._shell.tempdir to share' - ' the tempdir'] + ' plugins should set self._connection._shell.tmpdir to share' + ' the tmpdir'] del tmp if self._task.async_val and not self._supports_async: @@ -93,7 +93,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): elif self._task.async_val and self._play_context.check_mode: raise AnsibleActionFail('check mode and async cannot be used on same task.') - if self._connection._shell.tempdir is None and self._early_needs_tmp_path(): + if self._connection._shell.tmpdir is None and self._early_needs_tmp_path(): self._make_tmp_path() return result @@ -201,7 +201,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): def _early_needs_tmp_path(self): ''' - Determines if a temp path should be created before the action is executed. + Determines if a tmp path should be created before the action is executed. ''' return getattr(self, 'TRANSFERS_FILES', False) @@ -239,7 +239,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): except KeyError: admin_users = ['root', remote_user] # plugin does not support admin_users try: - remote_tmp = self._connection._shell.get_option('remote_temp') + remote_tmp = self._connection._shell.get_option('remote_tmp') except KeyError: remote_tmp = '~/ansible' @@ -267,7 +267,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): else: output = ('Authentication or permission failure. ' 'In some cases, you may have been able to authenticate and did not have permissions on the target directory. ' - 'Consider changing the remote temp path in ansible.cfg to a path rooted in "/tmp". ' + 'Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp". ' 'Failed command was: %s, exited with result %d' % (cmd, result['rc'])) if 'stdout' in result and result['stdout'] != u'': output = output + u", stdout output: %s" % result['stdout'] @@ -289,10 +289,10 @@ class ActionBase(with_metaclass(ABCMeta, object)): if rc == '/': raise AnsibleError('failed to resolve remote temporary directory from %s: `%s` returned empty string' % (basefile, cmd)) - self._connection._shell.tempdir = rc + self._connection._shell.tmpdir = rc if not use_system_tmp: - self._connection._shell.env.update({'ANSIBLE_REMOTE_TEMP': self._connection._shell.tempdir}) + self._connection._shell.env.update({'ANSIBLE_REMOTE_TMP': self._connection._shell.tmpdir}) return rc def _should_remove_tmp_path(self, tmp_path): @@ -302,8 +302,8 @@ class ActionBase(with_metaclass(ABCMeta, object)): def _remove_tmp_path(self, tmp_path): '''Remove a temporary path we created. ''' - if tmp_path is None and self._connection._shell.tempdir: - tmp_path = self._connection._shell.tempdir + if tmp_path is None and self._connection._shell.tmpdir: + tmp_path = self._connection._shell.tmpdir if self._should_remove_tmp_path(tmp_path): cmd = self._connection._shell.remove(tmp_path, recurse=True) @@ -316,7 +316,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): display.warning('Error deleting remote temporary files (rc: %s, stderr: %s})' % (tmp_rm_res.get('rc'), tmp_rm_res.get('stderr', 'No error string available.'))) else: - self._connection._shell.tempdir = None + self._connection._shell.tmpdir = None def _transfer_file(self, local_path, remote_path): self._connection.put_file(local_path, remote_path) @@ -493,8 +493,8 @@ class ActionBase(with_metaclass(ABCMeta, object)): ''' if tmp is not None: display.warning('_execute_remote_stat no longer honors the tmp parameter. Action' - ' plugins should set self._connection._shell.tempdir to share' - ' the tempdir') + ' plugins should set self._connection._shell.tmpdir to share' + ' the tmpdir') del tmp # No longer used module_args = dict( @@ -647,7 +647,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): module_args['_ansible_shell_executable'] = self._play_context.executable # make sure all commands use the designated temporary directory - module_args['_ansible_tempdir'] = self._connection._shell.tempdir + module_args['_ansible_tmpdir'] = self._connection._shell.tmpdir def _update_connection_options(self, options, variables=None): ''' ensures connections have the appropriate information ''' @@ -670,12 +670,12 @@ class ActionBase(with_metaclass(ABCMeta, object)): ''' if tmp is not None: display.warning('_execute_module no longer honors the tmp parameter. Action plugins' - ' should set self._connection._shell.tempdir to share the tempdir') + ' should set self._connection._shell.tmpdir to share the tmpdir') del tmp # No longer used if delete_remote_tmp is not None: display.warning('_execute_module no longer honors the delete_remote_tmp parameter.' - ' Action plugins should check self._connection._shell.tempdir to' - ' see if a tempdir existed before they were called to determine' + ' Action plugins should check self._connection._shell.tmpdir to' + ' see if a tmpdir existed before they were called to determine' ' if they are responsible for removing it.') del delete_remote_tmp # No longer used @@ -696,22 +696,22 @@ class ActionBase(with_metaclass(ABCMeta, object)): if not shebang and module_style != 'binary': raise AnsibleError("module (%s) is missing interpreter line" % module_name) - tempdir = self._connection._shell.tempdir + tmpdir = self._connection._shell.tmpdir remote_module_path = None if not self._is_pipelining_enabled(module_style, wrap_async): - # we might need remote temp dir - if tempdir is None: + # we might need remote tmp dir + if tmpdir is None: self._make_tmp_path() - tempdir = self._connection._shell.tempdir + tmpdir = self._connection._shell.tmpdir remote_module_filename = self._connection._shell.get_remote_filename(module_path) - remote_module_path = self._connection._shell.join_path(tempdir, remote_module_filename) + remote_module_path = self._connection._shell.join_path(tmpdir, remote_module_filename) args_file_path = None if module_style in ('old', 'non_native_want_json', 'binary'): - # we'll also need a temp file to hold our module arguments - args_file_path = self._connection._shell.join_path(tempdir, 'args') + # we'll also need a tmp file to hold our module arguments + args_file_path = self._connection._shell.join_path(tmpdir, 'args') if remote_module_path or module_style != 'new': display.debug("transferring module to remote %s" % remote_module_path) @@ -733,8 +733,8 @@ class ActionBase(with_metaclass(ABCMeta, object)): environment_string = self._compute_environment_string() remote_files = [] - if tempdir and remote_module_path: - remote_files = [tempdir, remote_module_path] + if tmpdir and remote_module_path: + remote_files = [tmpdir, remote_module_path] if args_file_path: remote_files.append(args_file_path) @@ -748,7 +748,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): (async_module_style, shebang, async_module_data, async_module_path) = self._configure_module(module_name='async_wrapper', module_args=dict(), task_vars=task_vars) async_module_remote_filename = self._connection._shell.get_remote_filename(async_module_path) - remote_async_module_path = self._connection._shell.join_path(tempdir, async_module_remote_filename) + remote_async_module_path = self._connection._shell.join_path(tmpdir, async_module_remote_filename) self._transfer_data(remote_async_module_path, async_module_data) remote_files.append(remote_async_module_path) @@ -770,7 +770,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): # maintain a fixed number of positional parameters for async_wrapper async_cmd.append('_') - if not self._should_remove_tmp_path(tempdir): + if not self._should_remove_tmp_path(tmpdir): async_cmd.append("-preserve_tmp") cmd = " ".join(to_text(x) for x in async_cmd) @@ -784,7 +784,7 @@ class ActionBase(with_metaclass(ABCMeta, object)): cmd = self._connection._shell.build_module_command(environment_string, shebang, cmd, arg_path=args_file_path).strip() - # Fix permissions of the tempdir path and tempdir files. This should be called after all + # Fix permissions of the tmpdir path and tmpdir files. This should be called after all # files have been transferred. if remote_files: # remove none/empty @@ -806,9 +806,9 @@ class ActionBase(with_metaclass(ABCMeta, object)): remove_internal_keys(data) if wrap_async: - # async_wrapper will clean up its tempdir on its own so we want the controller side to + # async_wrapper will clean up its tmpdir on its own so we want the controller side to # forget about it now - self._connection._shell.tempdir = None + self._connection._shell.tmpdir = None # FIXME: for backwards compat, figure out if still makes sense data['changed'] = True diff --git a/lib/ansible/plugins/action/assemble.py b/lib/ansible/plugins/action/assemble.py index 499943e0d9..8b69026a76 100644 --- a/lib/ansible/plugins/action/assemble.py +++ b/lib/ansible/plugins/action/assemble.py @@ -147,11 +147,11 @@ class ActionModule(ActionBase): if self._play_context.diff: diff = self._get_diff_data(dest, path, task_vars) - remote_path = self._connection._shell.join_path(self._connection._shell.tempdir, 'src') + remote_path = self._connection._shell.join_path(self._connection._shell.tmpdir, 'src') xfered = self._transfer_file(path, remote_path) # fix file permissions when the copy is done as a different user - self._fixup_perms2((self._connection._shell.tempdir, remote_path)) + self._fixup_perms2((self._connection._shell.tmpdir, remote_path)) new_module_args.update(dict(src=xfered,)) @@ -165,6 +165,6 @@ class ActionModule(ActionBase): except AnsibleAction as e: result.update(e.result) finally: - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/command.py b/lib/ansible/plugins/action/command.py index 7b263f6b28..79f1a7ff03 100644 --- a/lib/ansible/plugins/action/command.py +++ b/lib/ansible/plugins/action/command.py @@ -25,6 +25,6 @@ class ActionModule(ActionBase): if not wrap_async: # remove a temporary path we created - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return results diff --git a/lib/ansible/plugins/action/copy.py b/lib/ansible/plugins/action/copy.py index 28c606fb6c..887901bbf6 100644 --- a/lib/ansible/plugins/action/copy.py +++ b/lib/ansible/plugins/action/copy.py @@ -258,7 +258,7 @@ class ActionModule(ActionBase): return result # Define a remote directory that we will copy the file to. - tmp_src = self._connection._shell.join_path(self._connection._shell.tempdir, 'source') + tmp_src = self._connection._shell.join_path(self._connection._shell.tmpdir, 'source') remote_path = None @@ -273,7 +273,7 @@ class ActionModule(ActionBase): # fix file permissions when the copy is done as a different user if remote_path: - self._fixup_perms2((self._connection._shell.tempdir, remote_path)) + self._fixup_perms2((self._connection._shell.tmpdir, remote_path)) if raw: # Continue to next iteration if raw is defined. @@ -417,7 +417,7 @@ class ActionModule(ActionBase): # Define content_tempfile in case we set it after finding content populated. content_tempfile = None - # If content is defined make a temp file and write the content into it. + # If content is defined make a tmp file and write the content into it. if content is not None: try: # If content comes to us as a dict it should be decoded json. @@ -549,6 +549,6 @@ class ActionModule(ActionBase): result.update(dict(dest=dest, src=source, changed=changed)) # Delete tmp path - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/fetch.py b/lib/ansible/plugins/action/fetch.py index 64f81a1032..bc07d6a4fa 100644 --- a/lib/ansible/plugins/action/fetch.py +++ b/lib/ansible/plugins/action/fetch.py @@ -213,6 +213,6 @@ class ActionModule(ActionBase): result.update(dict(changed=False, md5sum=local_md5, file=source, dest=dest, checksum=local_checksum)) finally: - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/normal.py b/lib/ansible/plugins/action/normal.py index 3b73174a0c..766cebc5a3 100644 --- a/lib/ansible/plugins/action/normal.py +++ b/lib/ansible/plugins/action/normal.py @@ -52,6 +52,6 @@ class ActionModule(ActionBase): if not wrap_async: # remove a temporary path we created - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/package.py b/lib/ansible/plugins/action/package.py index 0e22031805..964d077eab 100644 --- a/lib/ansible/plugins/action/package.py +++ b/lib/ansible/plugins/action/package.py @@ -77,6 +77,6 @@ class ActionModule(ActionBase): finally: if not self._task.async_val: # remove a temporary path we created - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/patch.py b/lib/ansible/plugins/action/patch.py index d2d9dc10fd..535b9720f5 100644 --- a/lib/ansible/plugins/action/patch.py +++ b/lib/ansible/plugins/action/patch.py @@ -53,7 +53,7 @@ class ActionModule(ActionBase): except AnsibleError as e: raise AnsibleActionFail(to_native(e)) - tmp_src = self._connection._shell.join_path(self._connection._shell.tempdir, os.path.basename(src)) + tmp_src = self._connection._shell.join_path(self._connection._shell.tmpdir, os.path.basename(src)) self._transfer_file(src, tmp_src) self._fixup_perms2((tmp_src,)) @@ -68,5 +68,5 @@ class ActionModule(ActionBase): except AnsibleAction as e: result.update(e.result) finally: - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/script.py b/lib/ansible/plugins/action/script.py index 83ab129cd0..a1c474ce6b 100644 --- a/lib/ansible/plugins/action/script.py +++ b/lib/ansible/plugins/action/script.py @@ -89,7 +89,8 @@ class ActionModule(ActionBase): if not self._play_context.check_mode: # transfer the file to a remote tmp location - tmp_src = self._connection._shell.join_path(self._connection._shell.tempdir, os.path.basename(source)) + tmp_src = self._connection._shell.join_path(self._connection._shell.tmpdir, + os.path.basename(source)) # Convert raw_params to text for the purpose of replacing the script since # parts and tmp_src are both unicode strings and raw_params will be different @@ -133,6 +134,6 @@ class ActionModule(ActionBase): except AnsibleAction as e: result.update(e.result) finally: - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/service.py b/lib/ansible/plugins/action/service.py index 12893b2656..fc084194c1 100644 --- a/lib/ansible/plugins/action/service.py +++ b/lib/ansible/plugins/action/service.py @@ -85,6 +85,6 @@ class ActionModule(ActionBase): result.update(e.result) finally: if not self._task.async_val: - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/template.py b/lib/ansible/plugins/action/template.py index 71bcb8da9d..7e625bee5d 100644 --- a/lib/ansible/plugins/action/template.py +++ b/lib/ansible/plugins/action/template.py @@ -162,6 +162,6 @@ class ActionModule(ActionBase): except AnsibleAction as e: result.update(e.result) finally: - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/unarchive.py b/lib/ansible/plugins/action/unarchive.py index e0610f93b2..8686c2ac3a 100644 --- a/lib/ansible/plugins/action/unarchive.py +++ b/lib/ansible/plugins/action/unarchive.py @@ -84,7 +84,7 @@ class ActionModule(ActionBase): if not remote_src: # transfer the file to a remote tmp location - tmp_src = self._connection._shell.join_path(self._connection._shell.tempdir, 'source') + tmp_src = self._connection._shell.join_path(self._connection._shell.tmpdir, 'source') self._transfer_file(source, tmp_src) # handle diff mode client side @@ -92,7 +92,7 @@ class ActionModule(ActionBase): if not remote_src: # fix file permissions when the copy is done as a different user - self._fixup_perms2((self._connection._shell.tempdir, tmp_src)) + self._fixup_perms2((self._connection._shell.tmpdir, tmp_src)) # Build temporary module_args. new_module_args = self._task.args.copy() new_module_args.update( @@ -120,5 +120,5 @@ class ActionModule(ActionBase): except AnsibleAction as e: result.update(e.result) finally: - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result diff --git a/lib/ansible/plugins/action/win_copy.py b/lib/ansible/plugins/action/win_copy.py index a29ef4e9e3..3b4616c755 100644 --- a/lib/ansible/plugins/action/win_copy.py +++ b/lib/ansible/plugins/action/win_copy.py @@ -374,7 +374,7 @@ class ActionModule(ActionBase): source = content_tempfile except Exception as err: result['failed'] = True - result['msg'] = "could not write content temp file: %s" % to_native(err) + result['msg'] = "could not write content tmp file: %s" % to_native(err) return result # all actions should occur on the remote server, run win_copy module elif remote_src: @@ -487,15 +487,15 @@ class ActionModule(ActionBase): result.update(query_return) return result - if len(query_return['files']) > 0 or len(query_return['directories']) > 0 and self._connection._shell.tempdir is None: - self._connection._shell.tempdir = self._make_tmp_path() + if len(query_return['files']) > 0 or len(query_return['directories']) > 0 and self._connection._shell.tmpdir is None: + self._connection._shell.tmpdir = self._make_tmp_path() if len(query_return['files']) == 1 and len(query_return['directories']) == 0: # we only need to copy 1 file, don't mess around with zips file_src = query_return['files'][0]['src'] file_dest = query_return['files'][0]['dest'] copy_result = self._copy_single_file(file_src, dest, file_dest, - task_vars, self._connection._shell.tempdir) + task_vars, self._connection._shell.tmpdir) result['changed'] = True if copy_result.get('failed') is True: @@ -507,14 +507,14 @@ class ActionModule(ActionBase): # TODO: handle symlinks result.update(self._copy_zip_file(dest, source_files['files'], source_files['directories'], - task_vars, self._connection._shell.tempdir)) + task_vars, self._connection._shell.tmpdir)) result['changed'] = True else: # no operations need to occur result['failed'] = False result['changed'] = False - # remove the content temp file and remote tmp file if it was created + # remove the content tmp file and remote tmp file if it was created self._remove_tempfile_if_content_defined(content, content_tempfile) - self._remove_tmp_path(self._connection._shell.tempdir) + self._remove_tmp_path(self._connection._shell.tmpdir) return result |