summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/shell
Commit message (Collapse)AuthorAgeFilesLines
* improve become_method: runas error handling (#23328)Matt Davis2017-04-061-3/+27
| | | Prescriptive errors for username/password issues and NTLM/Kerb auth failures, cleans up exception noise.
* force Windows to always use preamble-free UTF8 input encoding (#22934)Matt Davis2017-03-241-0/+3
| | | | * fixes #15770 * When running under the UTF-8 codepage, Powershell subprocesses will fail (eg, Start-Job, others) if the input encoding is using the default BOM preamble. This fix forces it to use no preamble in leaf_exec and win_shell, and includes tests to verify that Start-Job works.
* fix Windows env handling (#22927)Matt Davis2017-03-231-3/+8
| | | | | * fixes #22441 * fixes #22655 * moves all env handling into the exec wrapper; this should work for everything but raw, which is consistent with non-Windows.
* Update module_utils.six to latest (#22855)Toshio Kuratomi2017-03-233-5/+5
| | | | | | | | * Update module_utils.six to latest We've been held back on the version of six we could use on the module side to 1.4.x because of python-2.4 compatibility. Now that our minimum is Python-2.6, we can update to the latest version of six in module_utils and get rid of the second copy in lib/ansible/compat.
* E501 fixes (#22879)Matt Martz2017-03-222-6/+6
|
* Suppress Windows Add-Type debug noise (#22722)Matt Davis2017-03-161-2/+0
|
* make windows async ... async (#22624)Matt Davis2017-03-141-14/+69
| | | Fixes #22575 - issue under new exec wrapper where unconstrained handle inheritance (for stdin) caused WinRM to block on breakaway processes. Uses explicit handle inheritance to ensure that only stdin read handle gets inherited. Adds test to ensure that async is actually async.
* prevent winrm Add-Type debug noise from polluting stderr (#22583)Matt Davis2017-03-131-0/+2
|
* suppress PS "unapproved verb" warning (#22018)Matt Davis2017-02-271-4/+4
|
* Complete rewrite of Windows exec wrapper (#21510)Matt Davis2017-02-172-0/+861
| | | | | | | | * supports pipelining for faster execution * supports become (runas), creates interactive subsession under WinRM batch logon * supports usage of arbitrary module_utils files * modular exec wrapper payload supports easier extension * integrates async wrapper behavior for pipelined/become'd async * module_utils are loaded as true Powershell modules, no more runtime modifications to module code
* fix powershell mkdtempBrian Coca2017-01-251-2/+2
|
* make sure tmpdir resolvs user dirs (#20486)Brian Coca2017-01-251-2/+6
| | | | | | | | | * make sure tmpdir resolvs user dirs fixes #20332 supercedes #20484 * typo fix
* Preserve exit code in winrm exec (#20166)Matt Davis2017-01-161-2/+6
| | | Raw winrm exec discards the exit code from external processes- this change preserves the exit code if present.
* Mcsalgado's change to use shlex.quote instead of pipes.quote (#18534)Toshio Kuratomi2016-11-173-16/+18
| | | | | | | | | | | | | | | | * Replace pipes.quote for shlex_quote * More migration of pipes.quote to shlex_quote Note that we cannot yet move module code over. Modules have six-1.4 bundled which does not have shlex_quote. This shouldn't be a problem as the function is still importable from pipes.quote. It's just that this has become an implementation detail that makes us want to import from shlex instead. Once we get rid of the python2.4 dependency we can update to a newer version of bundled six module-side and then we're free to use shlex_quote everywhere.
* Move uses of to_bytes, to_text, to_native to use the module_utils version ↵Toshio Kuratomi2016-09-061-6/+7
| | | | | | | | (#17423) We couldn't copy to_unicode, to_bytes, to_str into module_utils because of licensing. So once created it we had two sets of functions that did the same things but had different implementations. To remedy that, this change removes the ansible.utils.unicode versions of those functions.
* windows environment support (#17402)Matt Davis2016-09-061-2/+26
|
* Use file list, not recursion, in _fixup_perms. (#16924)Matt Clay2016-08-052-34/+14
| | | | | | | | | Run setfacl/chown/chmod on each temp dir and file. This fixes temp file permissions handling on platforms such as FreeBSD which always return success when using find -exec. This is done by eliminating the use of find when setting up temp files and directories. Additionally, tests that now pass on FreeBSD have been enabled for CI.
* Use find -exec + so that failures will be visible in find's exit code (#16389)Toshio Kuratomi2016-06-221-1/+1
| | | Fixes #16385
* Use find instead of -R for recursive setfacl (#16340)Toshio Kuratomi2016-06-171-3/+4
| | | | | (-R is not present on Solaris or freebsd setfacl) Fixes #16322
* Add work-around for ssh pty race condition.Matt Clay2016-05-191-0/+8
| | | | | This should minimize loss of stdout when using a pty and connecting with ssh or paramiko_ssh.
* Merge pull request #13771 from sivel/binary-modulesMatt Martz2016-05-122-6/+19
|\ | | | | First pass at allowing binary modules
| * Move binary module detection into executor/module_common.pyMatt Martz2016-05-122-1/+2
| |
| * Re-implement/move some code lost due to merge conflictsMatt Martz2016-05-121-2/+8
| |
| * Get binary modules working for windows, assuming .exe for windowsMatt Martz2016-05-121-3/+9
| |
* | Guard against a shell profile printing extraneous dataMatt Martz2016-05-121-1/+1
|/
* Use /var/tmp is user set remote_tmp below /var/tmp.Toshio Kuratomi2016-04-111-2/+21
| | | | | We want them to be able to influence this choice in case they want to keep files out of /tmp (perhaps to conserve RAM if that is a tmpfs).
* Always use system /tmp if system=True.Toshio Kuratomi2016-04-111-1/+1
| | | | | | Otherwise unexpected errors can happen when the user sets remote_tmp. Fixes #15372
* skip fixup_perms for PowershellMatt Davis2016-04-071-1/+7
| | | | | | | action plugins will now skip _fixup_perms for Powershell. We'll have to come up with another way to do this at some point, but it's not necessary yet since we don't support become on Windows. Also added NotImplementedError throws to chmod/chown/set_facl operations on Powershell (instead of returning '') in case anyone tries to use them in the future. fixes #15312
* Adding a config option to allow disabling locale settings upon module execJames Cammarata2016-04-061-5/+9
| | | | Fixes #15138
* fix Mac chown/chmod -R issue, add error checksnitzmahone2016-03-291-7/+13
| | | | | | The changes to chown/chmod were broken on Mac (-R was being appended to the end of the command- OSX requires it before the file list). A number of base action remote setup commands were also blindly proceeding without checking for success. Added error raises for unrecoverable failure cases.
* moved 'path exists' function to shellBrian Coca2016-03-252-0/+20
| | | | now it will work with powershell/winrm
* Merge pull request #14930 from ↵Matt Davis2016-03-251-1/+1
|\ | | | | | | | | mholiv/enable_dollar_as_first_char_in_folder_and_userName Modified files to use single quotes rather than double for file path.…
| * Modified files to use single quotes rather than double for file path. ↵root2016-03-111-1/+1
| | | | | | | | | | | | Powershell does not process $ variables in strings that are single quoted. Powershell DOES process $ variables that are in double quoted strings. Using single quotes enables ansible to handle file paths that contain folders that start with $. (i.e. C:/Users/$admin/...)
* | fix breakage from new recursive=True arg to chmodnitzmahone2016-03-241-1/+1
| |
* | Don't create world-readable module and tempfiles without explicit user ↵Toshio Kuratomi2016-03-231-2/+33
|/ | | | permission
* moved to base class for shell pluginsBrian Coca2016-02-095-92/+158
| | | | | | | fish now sets env vars correctly fish checksum now works fixed and cleaned up imports fixed typo
* Change $() into backticks. Backticks should work for both POSIX and ↵Toshio Kuratomi2016-02-021-2/+2
| | | | | | non-POSIX compatible shells. Fixes #14176
* Establish sh as the default shell plugin.Toshio Kuratomi2016-02-024-0/+24
| | | | This is a fix for one of the problems pointed out in #14176
* More fixes for unicode handling in the connection plugins.Toshio Kuratomi2016-01-061-2/+2
| | | | | Tested that ssh, docker, local, lxc-libvirt, chroot all work with the updated unicode integration test.
* changed shell delimiters for cshBrian Coca2015-12-121-0/+2
| | | | fixes #13459
* Now and/or shell expressions depend on shell pluginBrian Coca2015-12-032-6/+19
| | | | | | | | | This should fix issues with fish shell users as && and || are not valid syntax, fish uses actual 'and' and 'or' programs. Also updated to allow for fish backticks pushed quotes to subshell, fish seems to handle spaces w/o them. Lastly, removed encompassing subshell () for fish compatibility. fixes #13199
* Revert "Make sudo+requiretty and ANSIBLE_PIPELINING work together"Toshio Kuratomi2015-12-032-9/+4
| | | | | | This reverts commit f488de85997079f480d504f73537e3e33ff2495b. Reverting for now due to hard to pin down bugs: #13410 #13411
* allow shell plugin to affect remote module filenamenitzmahone2015-12-012-0/+11
| | | | Fix for 13368, added get_remote_filename to shell plugins, powershell version appends .ps1 if necessary, base shell plugin no-ops
* Make sudo+requiretty and ANSIBLE_PIPELINING work togetherAbhijit Menon-Sen2015-12-012-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pipelining is a *significant* performance benefit, because each task can be completed with a single SSH connection (vs. one ssh connection at the start to mkdir, plus one sftp and one ssh per task). Pipelining is disabled by default in Ansible because it conflicts with the use of sudo if 'Defaults requiretty' is set in /etc/sudoers (as it is on Red Hat) and su (which always requires a tty). We can (and already do) make sudo/su happy by using "ssh -t" to allocate a tty, but then the python interpreter goes into interactive mode and is unhappy with module source being written to its stdin, per the following comment from connections/ssh.py: # we can only use tty when we are not pipelining the modules. # piping data into /usr/bin/python inside a tty automatically # invokes the python interactive-mode but the modules are not # compatible with the interactive-mode ("unexpected indent" # mainly because of empty lines) Instead of the (current) drastic solution of turning off pipelining when we use a tty, we can instead use a tty but suppress the behaviour of the Python interpreter to switch to interactive mode. The easiest way to do this is to make its stdin *not* be a tty, e.g. with cat|python. This works, but there's a problem: ssh will ignore -t if its input isn't really a tty. So we could open a pseudo-tty and use that as ssh's stdin, but if we then write Python source into it, it's all echoed back to us (because we're a tty). So we have to use -tt to force tty allocation; in that case, however, ssh puts the tty into "raw" mode (~ICANON), so there is no good way for the process on the other end to detect EOF on stdin. So if we do: echo -e "print('hello world')\n"|ssh -tt someho.st "cat|python" …it hangs forever, because cat keeps on reading input even after we've closed our pipe into ssh's stdin. We can get around this by writing a special __EOF__ marker after writing in_data, and doing this: echo -e "print('hello world')\n__EOF__\n"|ssh -tt someho.st "sed -ne '/__EOF__/q' -e p|python" This works fine, but in fact I use a clever python one-liner by mgedmin to achieve the same effect without depending on sed (at the expense of a much longer command line, alas; Python really isn't one-liner-friendly). We also enable pipelining by default as a consequence.
* switched to backticks to allow for non bourne shells to workBrian Coca2015-10-291-2/+2
|
* Merge branch 'devel' of https://github.com/mathieumd/ansible into ↵James Cammarata2015-10-211-1/+1
| | | | mathieumd-devel
* Bundle a new version of python-six for compatibility along with some code to ↵six-compatToshio Kuratomi2015-10-161-1/+1
| | | | make it easy for distributions to override the bunndled copy if they have a new enough version.
* Double echo temp directory name to handle spaces and ~ expansion bothJames Cammarata2015-10-081-2/+2
| | | | Fixes #12667
* FIx typo arg_path (not plural)Toshio Kuratomi2015-10-021-1/+1
|
* Also add args_path param to powershell shell pluginJames Cammarata2015-10-021-1/+1
|