Commit graph

21190 commits

Author SHA1 Message Date
Victor Perron
972660968a paramiko_ssh: fix crash upon pass prompt in py3
The pass prompt expects an answer and compares a `str` to a binary buffer, thus crashing.

It's an obvious fix to help transitioning towards Python3 and hopes it does not need a specific test.
(cherry picked from commit bc44175d8d)
2017-03-29 07:48:09 -07:00
Toshio Kuratomi
2273800f7c Update submodule ref 2017-03-28 07:52:25 -07:00
James Cammarata
31300bd36b New release v2.2.2.0-1 2017-03-27 14:04:34 -05:00
Toshio Kuratomi
147c29f0e9 Update submodule refs 2017-03-22 20:49:07 -07:00
Brian Coca
de331a9488 clarify facts assignment for several corner cases
run_once/delegate_facts:
 now delegate_facts > run_once, previously run_once always published facts to all hosts in play

include_vars/delegate_to:
  now include_vars allows to delegate to a specific host

also fix task_vars exception in delegate_facts/loop as var was removed

fixes #15365

(cherry picked from commit 519f5db7ccb2f0114485521d432fb008c5b2dfce)
2017-03-15 16:02:36 -04:00
Brian Coca
36b462ba85 deal with other 'ungrouped' corner cases
(cherry picked from commit 2d9bf88897)
2017-03-09 20:12:01 -05:00
Brian Coca
b33c41dc5f readd all.add_host as for loop uses diff data
(cherry picked from commit 78e116077a)
2017-03-08 15:57:01 -05:00
Toshio Kuratomi
8b8f0597ed update submodule 2017-03-08 12:34:56 -08:00
Brian Coca
3ba057d28d backport inventory fix, ensure all/ungrouped 2017-03-08 14:58:10 -05:00
Brian Coca
ac4ce95810 backport of file cache perms fix
see #13093
2017-03-08 10:28:23 -05:00
Brian Coca
dae298e429 catch bad extra vars data earlier
Bad extra early (#22322)
(cherry picked from commit c71b15a696)
2017-03-07 13:46:30 -05:00
Matt Davis
c40d9e63bb refresh azure_rm.py from devel 2017-03-06 15:52:21 -08:00
Matt Davis
75c04b6773 refresh azure_rm.py from devel 2017-03-06 15:52:16 -08:00
James Cammarata
6ca528aea4 New release v2.2.2.0-0.2.rc2 2017-03-03 16:34:42 -06:00
Matt Davis
1a6e27a6ac fix azure_rm version checks (#22270)
* Use packaging.version.Version instead of LooseVersion for better support of prerelease tags (eg, 0.30.0 > 0.30.0rc6)
* Add explicit check/error for msrestazure package
(cherry picked from commit d12c93ef2b)
2017-03-03 13:29:06 -08:00
Toshio Kuratomi
d45f2d3288 Fix for traceback when we encounter non-utf8 characters in diff
We can diff non-utf8 files (as part of copy, for instance) but when we
try to turn the bytes into text for display, the characters cause
a traceback.  Since diff output is only informational, we can replace
those problematic bytes with replacement characters.  We do not want to
do this to other fields because those fields may be used inside of the
playbook (for templating another variable or matching in a conditional).

Fixes #21803
Fixes #21804

(cherry picked from commit 49db03c384)
2017-02-24 12:19:28 -08:00
Will Thames
e9e39e4fd6 Ensure ssh hostkey checks respect server port (#20840)
* Add tests for `get_fqdn_and_port` method.

Currently tests verify original behavior - returning default `ssh-keyscan` port
Add test around `add_host_key` to verify underlying command arguments
Add some new expectations for `get_fqdn_and_port`
Test that non-standard port is passed to `ssh-keyscan` command

* Ensure ssh hostkey checks respect server port

ssh-keyscan will default to getting the host key for port 22.
If the ssh service is running on a different port, ssh-keyscan
will need to know this.

Tidy up minor flake8 issues

* Update known_hosts tests for port being None

Ensure that git urls don't try and set port when a path
is specified

Update known_hosts tests to meet flake8

* Fix stdin swap context for test_known_hosts

Move test_known_hosts from under basic, as it is its own library.
Remove module_utils.known_hosts from pep8 legacy files list

(cherry picked from commit 103ede26df)
2017-02-24 12:19:28 -08:00
Matt Clay
1eda29bfa8 Test www.redhat.com instead of docs.ansible.com.
(cherry picked from commit 9462707f21)
2017-02-21 20:36:40 -08:00
James Cammarata
6791061395 New release v2.2.2.0-0.1.rc1 2017-02-21 18:03:37 -06:00
James Cammarata
694011a897 Additional lock down of conditionals
(cherry picked from commit 9751bf440e2b026874e70f950920e6dbee2e9115)
2017-02-21 17:42:44 -06:00
James Cammarata
cfd57fcae2 Rework how the Conditional class deals with undefined vars
Previously, the Conditional class did a simple check when an
AnsibleUndefinedVariable error was raised to see if certain strings were
present. This patch tries to be smarter by evaluating the variable contained
in the error string and compared to the defined/not defined conditionals in
the conditional string.

This also modifies the UndefinedError message from HostVars slightly to
match the format returned jinja2 in general, making it easier to match the
error message in the Conditional code.

Fixes #18514

(cherry picked from commit 81aa12eb1b)
2017-02-21 17:42:23 -06:00
James Cammarata
097dbb2daf Use proper YAML constructor class for safe loading
(cherry picked from commit 9f0b354023)
2017-02-21 16:24:45 -06:00
jctanner
c459f87a42 Skip fact gathering if the entire play was included via conditional and False (#21734)
Addresses #21528
(cherry picked from commit 40235d7b99)
2017-02-21 14:18:31 -06:00
jjlorenzo
547dcf4b9e set no_log for url_password
(cherry picked from commit 3befc894e1)
2017-02-21 10:44:17 -06:00
Virgil Dupras
f47356f5c7 Add missing entry in changelog for v2.2.1 (#19943)
That change was introduced in PR #18617
2017-02-17 08:18:08 -06:00
James Cammarata
fe3ede881d Relocate creation of Templar in process_pending_results
Moving it to after the blocks where per-item results are calculated,
as it's not used there and causes quite a performance hit being there.

Fixes #21340

(cherry picked from commit 7bf56ceee3)
2017-02-17 00:26:40 -06:00
Toshio Kuratomi
5dcce0666a Retain vault password as bytes in 2.2
Prior to 2.2.1, the vault password was read in as byes and then remained
bytes all the way through the code.  A bug existed where bytes and text
were mixed, leading to a traceback with non-ascii passwords.  In devel,
this was fixed by changing the read in password to text type to match
with our overall strategy of converting at the borders.  This was
backported to stable-2.2 for the 2.2.1 release.

On reflection, this should not have been backported as it causes
passwords which were originally non-utf-8 to become utf-8.  People will
then have their working 2.2.x vault files become in-accessible.

this commit pipes bytes all the way through the system for vault
password.  That way if a password is read in as a non-utf-8 character
sequence, it will continue to work in 2.2.2+.  This change is only for
the 2.2 branch, not for 2.3 and beyond.

Why not everywhere?  The reason is that non-utf-8 passwords will cause
problems when vault files are shared between systems or users.  If the
password is read from the prompt and one user/machine has a latin1
encoded locale while a second one has utf-8, the non-ascii password
typed in won't match between machines.  Deal with this by making sure
that when we encrypt the data, we always use valid utf-8.

Fixes #20398
2017-02-16 13:18:20 -08:00
James Cammarata
c92ce0c2ca Fix bug introduced in 0df3767 regarding undefined entries in HostVars
Fixes #21084

(cherry picked from commit eec88b63c2)
2017-02-15 16:23:24 -06:00
Toshio Kuratomi
1262e5fdca Fix hash filter for non-ascii strings and Python3
hashlib hashes operate on byte strings.  When given a text string on
Python3, hashlib backtraces.  When given a text string on Python2,
hashlib will backtrace if the string contains non-ascii characters.
Encode the text string to utf-8 prior to hashing to avoid this problem.

Fixes #21452

(cherry picked from commit 99fd2328af)
2017-02-15 11:59:42 -08:00
Matt Clay
cb93ecaef9 Fix @contextmanager leak on exception. (#21031)
* Fix @contextmanager leak on exception.
* Fix test leaks of global module args cache.

(cherry picked from commit 272ff10fa1)
2017-02-15 11:57:16 -08:00
James Cammarata
6176c95838 Also clean template data even if marked unsafe
Fixes #20568

(cherry picked from commit 86beb55a90)
2017-02-10 10:09:50 -06:00
Brian Coca
ef24d56c8f removed warn, which is added in 2.3
(cherry picked from commit 68dbed2a5e)
2017-02-10 08:31:22 -05:00
Brian Coca
f1217a9b94 use regex vs list to weed out password fields
- also warn as module SHOULD have no_log
 - make password regex exportable for testing
 - avoids boolean fields

(cherry picked from commit 403e9d35df)
2017-02-09 18:18:48 -05:00
Matt Davis
9029547603 bump submodule refs 2017-02-09 11:27:12 -08:00
Brian Coca
81e96c754a add url_password to 'cleanse' list
(cherry picked from commit 2f1ab29855)
2017-02-09 08:53:50 -05:00
jerry
c4b09cbcb4 removing unwanted variables and using to_native instead of str() 2017-02-08 15:53:19 -05:00
jeronimog
ef1ecfd2c2 Adding self.log() on IOErrors and OSErrros 2017-02-08 15:53:19 -05:00
Matt Clay
39acdde5aa Use older setuptools for sanity tests. 2017-02-06 14:53:05 -08:00
Toshio Kuratomi
7b2fcb2d4e Make sure that we're comparing text all the way through.
On Darwin, sys.platform returns byte strings on both python2 and
python3.  Turn it into a text string everywhere in order to remedy that.

Fixes #19845

(cherry picked from commit bfffd1952f)
2017-02-06 13:10:25 -08:00
Eugene Krokhalev
4e257fad84 [cloud] unicode is absent on Python 3, use text_type (#20861) 2017-02-03 16:34:52 -05:00
Toshio Kuratomi
3551de98c6 Split on newlines when checking for prompt matches (#20945)
* Check for the prompt as a substring of the output

sudo sometimes spits out warnings to stdout before getting to the
password prompt.  Account for that when trying to match a password
prompt.

Fixes #20858
(cherry picked from commit fee6e2953b)
2017-02-02 14:31:58 -08:00
Toshio Kuratomi
a0104cfe81 Do not substitute ssh_exeuctable until we need to
We need to use ssh_executable instead of hardcoding ssh in the command
we run but we need to use "ssh" when we lookup the value of the
{command}_extra_args variable.  Do this by leaving binary as "ssh" and
only expanding when we place it into b_command.

Fixes #20862

(cherry picked from commit 62ba084003)
2017-02-02 13:44:55 -08:00
Toshio Kuratomi
5f5d143194 Fix import of urlparse on python3
Should fix the error reported here:
https://github.com/ansible/ansible/issues/17495#issuecomment-267921719

(cherry picked from commit 4f960a4f42)
2017-01-30 09:44:04 -08:00
Peter Oliver
04b2e1fbc0 Fix setup on Solaris 8 and 9 (#20780)
Neither the `virtinfo` nor `smbios` commands exist on these systems, which was causing `setup` to fail with the error `Argument 'args' to run_command must be list or string`.
2017-01-27 17:46:45 -05:00
Brian Coca
65ee9d2e46 only ignore become for making tmpdir 2017-01-26 15:18:10 -05:00
Brian Coca
75de5737f7 fix improper setting become user for tmpdir
fixes #20706

(cherry picked from commit 0a8b856102)
2017-01-26 14:39:49 -05:00
Brian Coca
21106cc95b fix powershell mkdtemp
(cherry picked from commit 9e0fd313d7)
2017-01-25 13:19:51 -05:00
Brian Coca
89fdca0929 make sure tmpdir resolvs user dirs (#20486)
* make sure tmpdir resolvs user dirs

fixes #20332
supercedes #20484

* typo fix

(cherry picked from commit 10fa2cd0ef)
2017-01-25 13:19:51 -05:00
Matt Martz
7164956cc6 Add jinja2 groupby filter override to cast namedtuple to tuple. Fixes #20098 (#20362)
* Add jinja2 groupby filter override to cast namedtuple to tuple. Fixes #20098

* Address some of the requested changes

* Quoting

* Print the python path and version

* Be less explicitly verbose, rely on implicit verbosity
2017-01-19 12:23:03 -08:00
Matt Clay
0240ffe220 Disable pull of updated Shippable docker image.
This should improve reliability of our jobs on Shippable.

The Shippable AMIs should already have the latest docker image,
per Shippable support, so pull doesn't provide any benefit for us.

(cherry picked from commit 25caa67d41)
2017-01-19 11:45:35 -08:00