Commit graph

21154 commits

Author SHA1 Message Date
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
Matt Clay
db22594955 Update test to use keyserver.ubuntu.com.
(cherry picked from commit 4d616366c0)
2017-01-19 11:39:39 -08:00
Matt Clay
9e9d202d6f Use jinja2 import instead of pip to get version.
This resolves issues with older versions of pip.

(cherry picked from commit a8fb6f0958)
2017-01-19 11:07:43 -08:00
Matt Clay
b2942f1084 Only test map on jinja2 >= 2.7
(cherry picked from commit ad65274643)
2017-01-19 09:01:25 -08:00
Toshio Kuratomi
26f5e4b32d Fix linenos being wrong in inventory errors
Fixes #20356

(cherry picked from commit 05879d331a)
2017-01-19 08:41:05 -08:00
James Cammarata
e85f3f4461 Add representer to AnsibleDumper for AnsibleUnsafeText
Fixes #20253
Fixes #20290
2017-01-19 10:12:22 -06:00
James Cammarata
f4ecbc4c3f Fixing iterator bug related to reworking of end-of-role detection
Bug was introduced in cae682607

(cherry picked from commit 9d549c3498)
2017-01-19 10:11:52 -06:00
James Cammarata
b12256acf2 Reworking the way end of role detection is done
Rather than trying to enumerate tasks or track an ever changing cur_role
flag in PlayIterator, this change simply sets a flag on the last block in
the list of blocks returned by Role.compile(). The PlayIterator then checks
for that flag when the cur_block number is incremented, and marks the role
as complete if the given host had any tasks run in that role.

Fixes #20224

(cherry picked from commit cae682607c)
2017-01-19 10:11:44 -06:00
Toshio Kuratomi
f649a87a19 Remove restriction on maximum jinja2 version as we're hoping the next release will work with jinja2-2.9 2017-01-16 11:24:22 -08:00
James Cammarata
2f0dba4f36 Fix for bug in Conditional for older jinja2 versions
Fixes #20309

(cherry picked from commit af96cba7e1)
2017-01-16 13:17:06 -06:00
Toshio Kuratomi
6a9572e1e5 Update submodule refs 2017-01-16 11:11:25 -08:00
James Cammarata
5362910000 New release v2.2.1.0-1 2017-01-16 10:13:31 -06:00
James Cammarata
009ac7b65e Forgot to add the release date to the CHANGELOG 2017-01-16 09:59:06 -06:00
James Cammarata
c6ef74d81b Updating CHANGELOG 2017-01-16 09:51:22 -06:00
James Cammarata
0c153146e3 New release v2.2.1.0-0.5.rc5 2017-01-13 16:44:45 -06:00
James Cammarata
86eadc5814 Additional security fixes for CVE-2016-9587
(cherry picked from commit b7cdc21aee)
2017-01-13 16:23:14 -06:00
Brian Coca
4b495d7e43 fix issue when proc read returns None
fixes #20225
2017-01-13 14:06:11 -05:00
Matt Clay
c846e915f8 Correct freebsd startup test for CI. 2017-01-13 10:03:11 -08:00
Matt Clay
a93e7506a8 Test with jinja2 < 2.9. 2017-01-12 14:00:39 -08:00
Brian Coca
49fc0cfe4f deal with remote_src and tmp dirs properly
fixes #20128

(cherry picked from commit 8c6b5621f8)
2017-01-12 14:10:16 -05:00
Brian Coca
d1c5a39420 ansible doc does not need plugin deprecation error
(cherry picked from commit 74421f42e1)
2017-01-12 13:10:44 -05:00
Toshio Kuratomi
06ed25e788 Add jinja2 version constraint.
We're not yet compatible with jinja2-2.9 so help out people using pip to
install to get a working installation.
2017-01-12 10:01:29 -08:00
James Cammarata
b3daa9dd64 New release v2.2.1.0-0.4.rc4 2017-01-11 16:25:28 -06:00
James Cammarata
6dee2b21e6 Partial revert of 76f7ce55
(cherry picked from commit a94a48f85f)
2017-01-11 15:53:39 -06:00
James Cammarata
cc4634a5e7 Additional fixes for security related to CVE-2016-9587
(cherry picked from commit d316068831)
2017-01-11 15:53:38 -06:00
Computest
eb8c26c105 Fixing another corner case for security related to CVE-2016-9587
(cherry picked from commit bcceada5d9)
2017-01-11 15:53:37 -06:00
Marius Gedminas
240c388e6c Fix a test failure on Python 3.6 (#20030)
* Fix a test failure on Python 3.6

tox -e py36 failed with

    ======================================================================
    ERROR: test_action_base__execute_module (units.plugins.action.test_action.TestActionBase)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/mg/src/ansible/test/units/plugins/action/test_action.py", line 507, in test_action_base__execute_module
        self.assertEqual(action_base._execute_module(), dict(_ansible_parsed=True, rc=0, stdout="ok", stdout_lines=['ok']))
      File "/home/mg/src/ansible/lib/ansible/plugins/action/__init__.py", line 596, in _execute_module
        remote_module_path = self._connection._shell.join_path(tmp, remote_module_filename)
      File "/home/mg/opt/python36/lib/python3.6/unittest/mock.py", line 939, in __call__
        return _mock_self._mock_call(*args, **kwargs)
      File "/home/mg/opt/python36/lib/python3.6/unittest/mock.py", line 1005, in _mock_call
        ret_val = effect(*args, **kwargs)
      File "/home/mg/src/ansible/.tox/py36/lib/python3.6/posixpath.py", line 92, in join
        genericpath._check_arg_types('join', a, *p)
      File "/home/mg/src/ansible/.tox/py36/lib/python3.6/genericpath.py", line 149, in _check_arg_types
        (funcname, s.__class__.__name__)) from None
    TypeError: join() argument must be str or bytes, not 'MagicMock'

because os.path.join() now checks argument types since Python 3.6 (due
to pathlib support, I expect).

* Use a more realistic module name in test

(cherry picked from commit d9b89ca577)
2017-01-10 07:37:36 -08:00
Matt Clay
941552d107 Fix group_by test to work with jinja2 >= 2.9.
(cherry picked from commit cc3d131f50)
2017-01-09 15:26:52 -08:00
James Cammarata
d8c9b8d347 New release v2.2.1.0-0.3.rc3 2017-01-09 10:49:01 -06:00
James Cammarata
ec84ff6de6 Fixing security bugs for CVE-2016-9587
(cherry picked from c8f8d0607c5c123522951835603ccb7948e663d5)
2017-01-09 10:43:38 -06:00
Toshio Kuratomi
56de9d8ae7 Update submodule refs 2017-01-05 15:56:25 -08:00
Toshio Kuratomi
3e2f6e5094 Allow OSError to skip scriptdir removal
On Ubuntu the scriptdir gets placed into sys.path.  This makes some
modules (copy) fail because the ansible module gets loaded instead of
the stdlib copy module.  So we remove scriptdir there.  Unfortunately,
the scriptdir code uses abspath().  When pipelining, abspath() has to
find the cwd.  On OSX, finding the cwd when that directory is not
executable by the user raises an OSError.  Since OSX does not suffer
from the scriptdir problem we're able to just skip scriptdir handling if
we get that exception.

Fixes #19729

(cherry picked from commit 03510ec4ce)
2017-01-05 15:56:00 -08:00
Brian Coca
577ea88f78 bad module commit 2017-01-05 18:01:30 -05:00
Brian Coca
7e10994b6d allow modules to set custom stats
can be per run or per host, also aggregate or not
set_stats action plugin as reference implementation
added doc stub
2017-01-05 16:39:39 -05:00
Toshio Kuratomi
f6a3c4f071 Update submodule refs 2017-01-04 17:19:08 -08:00
Toshio Kuratomi
8439d1813e Fix for atomic_move on RHEL5
When becoming an unprivileged user using non-sudo on a platform where
getlogin() failed in our situation we were not able to detect that the
user had switched.  This meant that all of our logic to use move vs copy
if the user had switched was attempting the wrong thing.  This change
tries the to do the right thing but then falls back to an acceptable
second choice if it doesn't work.

The bug wasn't easily detected because:
* sudo was not affected because sudo records that the user's have been
  switched so we were able to detect that.
* getlogin() works on most platforms.  RHEL5 with python-2.4 seems to be
  the only platform we still care about where getlogin() fails for this
  case.
* It had to be becoming an unprivileged user.  When becoming
  a privileged user, the user would be able to successfully perform the
  best case tasks.

(cherry picked from commit 02e3f4b526)
2017-01-04 14:10:36 -08:00
Brian Coca
e223349edc fixed id queries, should rely on effective
(cherry picked from commit 92e8c53879)
2017-01-04 14:23:50 -05:00