Commit graph

1712 commits

Author SHA1 Message Date
Toshio Kuratomi
69301f2823 make hash_params more robust in the face of many corner cases (#18701)
* make hash_params more robust in the face of many corner cases

Fixes #18680
Alternative fix to #18681

* add test case for role.hash_params

* Add role.hash_params test for more types

A set, a generator/iterable, and a Container that
is not Iterable.

(cherry picked from commit 5f5ea06ca4)
2016-12-05 04:02:21 -08:00
Matt Clay
97444c5e59 Corrected placement templates for test_lookups. 2016-11-29 15:16:38 -08:00
Virgil Dupras
4854705267 Fix regression in jinja2 include search path (#18617)
* Fix regression in jinja2 include search path

Since commit 3c39bb5, the 'ansible_search_path' variable is used to set
jinja2's search path for {% include %} directives. However, this path is
the the proper one because our templates live in 'templates' subdirs in
our search path.

This is a regression because previously, our include search path would
include the dirname of the currently interpreted file, which worked most
of the time.

fixes #18526

* Fix template lookup search path

Improve fix in commit c96c853 so that the search path contain both
template-suffixed paths as well as original paths.

ref PR #18617

* Add integration test for template lookups

Tests regression at #18526

This test fails on current devel branch and succeeds on PR #18617

(cherry picked from commit bf48383610)
2016-11-29 16:23:23 -05:00
Daniel Miranda
a7abe4be19 Make sure include_role inherit variables from parent role (#18627)
* Make sure include_role inherit variables from parent role

Setting the parent of task blocks generated by include_role after they
have been produced is not sufficient - it means the tasks don't have the
correct dependency chain set afterwards, and therefore, don't properly
inherit variables from outer roles.

In addition to manually setting the parents, pass the dep_chain when
compiling the role, such that variables are correctly imported.

Fixes #18540.

* Add tests for include_role

* Fix include_role variable inheritance for multiple parent levels

(cherry picked from commit 57f4a9885e)
2016-11-29 11:26:17 -05:00
Matt Davis
d637559825 manual backport of win_async test changes from devel 2016-11-18 11:47:08 -08:00
James Cammarata
0871d955fe Reworking iterator logic regarding failed states during always
Previous changes addressed a corner case, which unfortunately introduced
another bug. This patch adds a new flag to the host state (did_rescue) which
is set to true when the rescue portion of a block completes. This flag is
then checked in _check_failed_state() when the fail_state != FAILED_NONE.

This lead to the discovery of another bug - current strategies are not advancing
hosts to ITERATING_COMPLETE after doing a peek at the next task, leaving the
host state in the run_state of the final task. To address this, before gathering
the list of failed hosts in StrategyBase.run(), a final pass through the iterator
for all hosts is done to ensure each host is in its final state. This way, no
strategy derived from StrategyBase has to worry about it and it's handled.

Fixes #17983

(cherry picked from commit ca5b361ad8)
2016-11-18 11:09:36 -06:00
James Cammarata
c23d99b786 Alternately track listening handlers by uuid if no name is set
Fixes #17846

(cherry picked from commit 4f06a86161)
2016-11-13 15:28:38 -06:00
James Cammarata
6bd4bec9de Fixing incorrect use of version_compare in docker integration test 2016-11-11 11:45:37 -06:00
Matt Clay
b482cdcf03 Fix docker connection unit tests.
- Use assertRaisesRegexp to make sure correct exceptions are raised.
- Set docker_command to avoid docker dependency (skips find_executable).
- Use a fake path for docker_command to make sure mock.patch is working.

(cherry picked from commit 8552ad6bf1)
2016-11-09 10:45:47 -08:00
Adrian Likins
366bfe14c3 Fix bug (#18355) where encrypted inventories fail 18355 (#18373)
* Fix bug (#18355) where encrypted inventories fail

This is first part of fix for #18355
* Make DataLoader._get_file_contents return bytes

The issue #18355 is caused by a change to inventory to
stop using _get_file_contents so that it can handle text
encoding itself to better protect against harmless text
encoding errors in ini files (invalid unicode text in
comment fields).

So this makes _get_file_contents return bytes so it and other
callers can handle the to_text().

The data returned by _get_file_contents() is now a bytes object
instead of a text object. The callers of _get_file_contents() have
been updated to call to_text() themselves on the results.

Previously, the ini parser attempted to work around
ini files that potentially include non-vailid unicode
in comment lines. To do this, it stopped using
DataLoader._get_file_contents() which does the decryption of
files if vault encrypted. It didn't use that because _get_file_contents
previously did to_text() on the read data itself.

_get_file_contents() returns a bytestring now, so ini.py
can call it and still special case ini file comments when
converting to_text(). That also means encrypted inventory files
are decrypted first.

Fixes #18355

(cherry picked from commit dd0189839e)
2016-11-07 10:15:09 -05:00
Steve Kuznetsov
e13f3e3c07 Change v2_playbook_on_start logic to positively detect legacy plugins
In order to support legacy plugins, the following two method signatures
are allowed for `CallbackBase.v2_playbook_on_start`:

def v2_playbook_on_start(self):
def v2_playbook_on_start(self, playbook):

Previously, the logic to handle this divergence checked to see if the
callback plugin being called supported an argument named `playbook`
in its `v2_playbook_on_start` method. This was fragile in a few ways:
 - if a plugin author did not use the literal `playbook` to name their
   method argument, their plugin would not be called correctly
 - if a plugin author wrapped their `v2_playbook_on_start` method and
   by doing so changed the argspec to no longer expose an argument
   with that literal name, their plugin would not be called correctly

In order to continue to support both types of callback for backwards
compatibility while making the call more robust for plugin authors,
the logic can be reversed in order to have a positive check for the old
method signature instead of a positive check for the new one.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
(cherry picked from commit 0bc35354ce)
2016-11-01 07:53:04 -07:00
Matt Robinson
325bf617e9 Set ansible_os_family correctly under KDE neon
As neon is derived from Ubuntu, ansible_os_family should have the value
"Debian" instead of "Neon".  Add a test case for KDE neon and set
os_family correctly for it.

(cherry picked from commit 4ff8890ec1)
2016-11-01 07:53:04 -07:00
Toshio Kuratomi
d559355b29 Add tests for dnf modelled after the yum tests (#18226)
(cherry picked from commit 02859a3e32)
2016-10-31 10:57:11 -07:00
Matt Davis
79e43925b1 add large interleaved stdout/stderr integration tests for win_shell/win_command
(cherry picked from commit c1b7d2e560)
2016-10-25 17:38:25 -07:00
Toshio Kuratomi
9d82a3aa0c Fix the uri testserver to run on python3
(cherry picked from commit 589e71dbc5)
2016-10-24 06:51:10 -07:00
Matt Davis
4d5368e93b reenable win_async loop test
(cherry picked from commit 9a78273665)
2016-10-24 00:03:42 -07:00
stephane
f5240d2953 Set Suse family for openSUSE Tumbleweed & Leap
On openSUSE Tumbleweed, lsb-release -a currently reports
the distributor ID as "openSUSE Tumbleweed". On openSUSE
Leap, the distributor ID is "SUSE LINUX".

Add them to the OS_FAMILY dict as Suse family systems.

Also add an entry to TESTSETS in test_distribution_version.py
for openSUSE Tumbleweed.

(cherry picked from commit 77868a4104)
2016-10-23 02:05:32 +02:00
Toshio Kuratomi
8dbc564fc6 Enable the git test on py3
(cherry picked from commit 2ac12432ef)
2016-10-21 09:07:18 -07:00
Ssawa
90d3824678 Handle 'smart' scp_if_ssh option for fetch (#18125)
(cherry picked from commit 8e47b9bc70)
2016-10-21 10:02:51 -04:00
Michael Scherer
5bd6a9b76c Enable filters test for python 3
(cherry picked from commit 2804e64ed5)
2016-10-20 23:37:32 -07:00
Toshio Kuratomi
3ee4effb7a pip tests now pass on python3. Enable them.
(cherry picked from commit 67ac375188)
2016-10-20 13:59:03 -07:00
Michael Scherer
b6e51d670a Enable test for lookups on python 3
Since passlib algo sometime takes a bytes, and sometime
not, depending on a internal variable, we have to convert
bnased on it, or it fail with "TypeError: salt must be bytes,
not str" (or unicode instead of bytes)

However, that's not great to use internal structure for that.

(cherry picked from commit 578da9a615)
2016-10-20 13:24:34 -07:00
Toshio Kuratomi
f15ec38788 Thanks to mscherer, these tests are now passing
(cherry picked from commit fd14048d46)
2016-10-20 10:59:46 -07:00
Michael Scherer
ddbc01dfe5 Let authorized_keys be tested on python 3
(cherry picked from commit e93a8814a3)
2016-10-20 10:58:10 -07:00
John R Barker
ba8e1f88a9 Port validate-modules to stable-2.2 (#18119) 2016-10-20 18:22:58 +01:00
Adrian Likins
fa8f9e9ead Fix test_filters fail because of dict sort (#18105)
Fixes #17308
(cherry picked from commit f99ffb5620)
2016-10-19 16:11:37 -04:00
Toshio Kuratomi
257182e46a Pixelrebel amc pr2654 (#18089)
* Add tag verification test (ansible-modules-core PR 2654)

* Fix typo

* Use smaller repo for testing, add dependency control

* Test is gpg exists before running git signing tasks

* Correct the test conditionals so that gpg1 is tested

(cherry picked from commit b902b5d046)
2016-10-19 08:42:17 -07:00
Toshio Kuratomi
1e54f424ec epdb doesn't work on python3 so we need a different package to test pip
(cherry picked from commit 7e0bd5632d)
2016-10-17 18:45:38 -07:00
Toshio Kuratomi
b373f67368 Fix ansible-pull on python3
On python3, we can't write bytes directly to sys.stdout.

(cherry picked from commit 60acfd1e87)
2016-10-17 16:32:47 -07:00
Brian Coca
dde882c91f updated pbrun test to match expected output
(cherry picked from commit 04b86df815)
2016-10-17 14:43:02 -04:00
Toshio Kuratomi
261013354f unarchive tests now pass on python3
(cherry picked from commit 91c1fdec3d)
2016-10-15 08:51:00 -07:00
Toshio Kuratomi
f59430aba8 Add a whitelist for checking for six. Use it for digital_ocean.py
(cherry picked from commit 6a61b6d431)
2016-10-06 11:00:26 -07:00
Toshio Kuratomi
08b646684b Make ini parsing slightly more robust
Prior to this commit, the ini parser would fail if the inventory was
not 100% utf-8.  This commit makes this slightly more robust by
omitting full line comments from that requirement.

Fixes #17593

(cherry picked from commit 23305540b4)
2016-10-04 11:25:45 -07:00
Toshio Kuratomi
b878c47d5e Fix for run_command tests now that it returns native strings
(cherry picked from commit 08a58ae025)
2016-10-03 18:46:55 -07:00
Matt Clay
ae52943719 Update default branch for generate-tests. 2016-10-03 12:34:51 -07:00
Matt Clay
52173e7707 Update CI config for stable-2.2 branch. (#17880) 2016-10-03 11:39:01 -07:00
Toshio Kuratomi
5bc3cb278c Remove unicode escape (#17866)
* Remove unicode-escape which is not present on python3

Alternative fix for #17305

* Enable the assemble test on python3

* Fix other problems with assemble on python3
2016-10-02 22:12:51 -07:00
Matt Davis
aa0ad073b8 bugfixes to JSON junk filter, added unit/integration tests to exercise (#17834) 2016-10-02 08:03:42 -07:00
Matt Clay
21857e8618 Disable privileged mode on Shippable. (#17844) 2016-09-30 22:06:28 -07:00
Brian Coca
dfff608ceb dzdo prompt fix
fixed tests
dzdo has 2 paths now, with and w/o password
fixes #17838
2016-09-30 17:58:19 -04:00
jctanner
fff161f2f6 Smart mode for sftp+scp (#17813)
If the sftp fails, roll over to scp by default. This saves users
from having to know about the scp_if_ssh method when sftp is broken
on the remote host.
2016-09-29 17:44:54 -04:00
Adrian Likins
1f03801fcc mv test_git to 'destructive' integration tests (#17526)
The test_git role removes ~/.ssh/known_hosts currently
and that is destructive.
2016-09-29 13:46:34 -04:00
Toshio Kuratomi
4452ee86bd Turn mount test back on (#17797)
* Turn mount test back on

* Mount tests need PRIVILEGED so turn that back on

Revert "Revert "Set PRIVILEGED=true for non_destructive tests. (#17733)" (#17738)"

This reverts commit dc0fb1c212.

* Add a needs_privileged tag so that we can skip mount tests on centos6

Some containers timeout on shippable tests when run with privileged.
Unfortunately, some tests require that in order to run.  Tagging those
allows us to skip those tests on the platforms that timeout when we get
ready to run the integration test in shippable.

* Centos6 times out with PRIVILEGED set so remove that (will disable the mount tests on centos6)

* Remove false start
2016-09-28 10:52:33 -07:00
Toshio Kuratomi
efa78b4ff4 The mode that we fake from stat is checked more closely under python3.5 on El Capitan (#17794)
Python2 seems to allow any integer.  Python3.5 on Linux seems to allow
a 32 bit unsigned int.  Python3.5 on El Capitan seems to limit it to
a smaller size...  perhaps a 16 bit int.
2016-09-28 08:24:28 -07:00
Matt Clay
a265d2d77d Run test_template tests on OS X. (#17791) 2016-09-27 23:30:58 -07:00
Matt Clay
0dc3db9e75 Enable unarchive tests for OS X and FreeBSD. (#17789) 2016-09-27 21:37:24 -07:00
Adrian Likins
bba0fb3a42 Add mnt pnts with single quote to test (16855) (#17771)
This adds some test data to test_facts.py that
includes mnt points that have a single quote in
the path.

Ala, https://github.com/ansible/ansible/issues/16855

The bug was already fixed via other changes, but this is
for regression testing.
2016-09-27 20:21:25 -07:00
Matt Clay
6d78397b8b Update get_url test to use httptester. (#17787) 2016-09-27 18:11:09 -07:00
Matt Clay
d05df5fc61 Disable expect continue in ansible-core-ci. (#17737)
This will allow use of larger SSH keys.
2016-09-23 22:09:46 -07:00
Toshio Kuratomi
1f311f0739 Disable mount tests for now. Mount is buggy on too many platforms 2016-09-23 16:35:34 -07:00