Commit graph

21075 commits

Author SHA1 Message Date
Dag Wieers
268645c17a Fix regression in search path behaviour
This PR fixes a few issues:

- Missing role parent directory for relative paths
- Fix integration tests (add missing stage)
- Redesign integration tests
- Incorrect order with tasks-lookups
- Duplicate paths are listed
- Repetitive tasks/tasks or files/files were possible

==== using copy with test.txt
Before:
```
   491 1481281038.29393: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
        /home/dag/home-made/ansible.testing/test.txt
```

After:
```
 32505 1481280963.22418: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
        /home/dag/home-made/ansible.testing/test.txt
```

==== Using copy with files/test.txt

Before:
```
 31523 1481280499.63052: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/files/files/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
```

After:
```
 31110 1481280299.38778: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt
        /home/dag/home-made/ansible.testing/files/test.txt
```

==== Using template with files/test.txt.j2
Before:
```
 30074 1481280064.15191: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/files/test.txt.j2
```

After:
```
 29201 1481279823.52752: search_path:
        /home/dag/home-made/ansible.testing/roles/test134/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/roles/test134/tasks/files/test.txt.j2
        /home/dag/home-made/ansible.testing/templates/files/test.txt.j2
        /home/dag/home-made/ansible.testing/files/test.txt.j2
```

This fixes #19048

(cherry picked from commit 7c71c678fa)
2016-12-14 11:18:31 -05:00
René Moser
e715221a66 cloudstack: utils: fail friendlier if no zones available (#19332)
(cherry picked from commit 18b7852940)
2016-12-14 16:37:09 +01:00
James Cammarata
fe33c937c4 New release v2.2.1.0-0.2.rc2 2016-12-14 09:09:02 -06:00
Toshio Kuratomi
cbf1f23e7e Fixes for uri under python3 and local (non-httptester) testing
(cherry picked from c6b42028c4)
2016-12-13 15:55:06 -08:00
Lumír 'Frenzy' Balhar
0db1c77041 Fix AST nodes for Python 3 and enable dependent test_uri (#18597)
* Enable tests on python 3 for uri

* Added one more node type to SAFE_NODES into safe_eval module.

ast.USub represents unary operators. This is necessary for
parsing some unusual but still valid JSON files during testing
with Python 3.

(cherry picked from commit 84544ee8fd)
2016-12-13 07:38:07 -08:00
Toshio Kuratomi
ddc8d3d988 Update submodule refs 2016-12-13 05:57:46 -08:00
Toshio Kuratomi
3beac89893 Remove itervalues (not available on py3)
(cherry picked from 51491c9904)
2016-12-13 05:57:46 -08:00
ikelos
abc0eeac02 Fix overwrite parameter in module_utils.junos (#18671)
The overwrite parameter is forcibly set to false, meaning a module
passing that parameter will have no effect.  The overwrite facility
is necessary to ensure that conflicting options can be written the
configuration (which, in replace mode, they cannot).

This change ensures that if overwrite is set, it will not be changed
to False in the logic.
(cherry picked from commit 9e5d4de49a)
2016-12-12 15:58:03 -05:00
Patrick Ogenstad
886f8d224e Disable CLI errors when typing enable (#18531)
(cherry picked from commit 05e5474c52)
2016-12-12 15:55:56 -05:00
Juan Antonio Valiño García
76be9aa693 Fixes #18663. Bad handling of existing config in dellos9 module. (#18664)
* Fixes #18663. Bad handling of existing config in dellos9 module.

The dellos9 module doesn't build correctly the internal
structures used to represent the existing config of the managed
network device. This leads to apply changes every time the
playbook is run, even if the existing config is the same that the
one you are trying to push into the device.

Probably this problem exist also in the dellos6 and dellos10
modules, but I only fixed it in the dellos9 module.

The fix modifies two methods. The first one is `get_config`,
where the return clause didn't work correctly when the flow
doesn't enter in the `if` block. In that case the `contents`
variable is not an array an this should be handled.

The second fix is in the `get_sublevel_config` method. In this
case the indentation whitespaces of the parents should be rebuild
because further functions and methods required it to handle
correctly comparisons used to check if changes should be pushed
into device.

* Fixes #18663 for dellos10 module with the same patches as dellos9.

(cherry picked from commit 40ddbe026d)
2016-12-12 15:52:52 -05:00
Matt Clay
acad2ba246 Support script interpreters for async_wrapper. (#18592)
(cherry picked from commit d61b2ed0a3)
2016-12-06 06:55:15 -08:00
Toshio Kuratomi
47cd4867a1 Update submodule refs 2016-12-05 04:02:39 -08:00
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
Toshio Kuratomi
6025e97d13 ssh-keyscan can fail to find keys for a host.
When it does, we need to fail otherwise other code will fail later.

Fixes #18676

(cherry picked from commit 0d9afa84d5)
2016-12-01 23:44:22 -08:00
Toshio Kuratomi
01fa3d3024 Transform vault_pass into text when we read it in from the user or a file. (#18699)
Fixes #18684
(cherry picked from commit 74a10d7ca2)
2016-12-01 23:43:11 -08:00
Benoît Allard
18aba3ebec with_sequence: Fix indentation
This doesn't need to run for every parameters. Once is enough.
(cherry picked from commit 7db4ed02ee)
2016-11-30 21:14:17 -08:00
Alberto Murillo
b15e1b743f Fix fetching files with scp (#18673)
Commit ec2521f intended to fix the scp command to fetch files
from a remote machine but it has src and dest swapped.

This change correctly treats src as the location in the remote machine
and dest as the location in the local machine.

Signed-off-by: Alberto Murillo Silva <alberto.murillo.silva@intel.com>
(cherry picked from commit 7542dae26b)
2016-11-30 20:13:07 -08:00
Matt Clay
97444c5e59 Corrected placement templates for test_lookups. 2016-11-29 15:16:38 -08:00
Matt Davis
4ef8493a11 bump submodule refs 2016-11-29 14:28:32 -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
James Cammarata
ff60245e2b Updating core submodules for mysql fix 2016-11-29 13:25:46 -06: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
Toshio Kuratomi
faaabec397 Fix for AnsiballZ when the remote clock is behind (#18660)
Some machines have system clocks which can fall behind (for instance,
a host without a CMOS battery like Raspberry Pi).  When managing those
machines we have to workaround the fact that the zip format does not
handle file timestamps before 1980.  The workaround is to substitute in
the timestamp from the controller instead of from the managed machine.

Fixes #18640
(cherry picked from commit 3c6d71522e)
2016-11-29 01:22:22 -08:00
Adrian Likins
288f6684cf Fix traceback in atomic_move (#18649)
Commit 8b08a28c89 removed a
call to get_exception() that was needed. Without it, the fail_json
references an undefined variable ('exception') and throws an exception.

Add the get_exception() back in where needed and update references.

Now the proper module failure is returned.

Fixes #18628
(cherry picked from commit dbbd2d79ff)
2016-11-28 15:32:30 -05:00
Peter Sprygada
b878e8f0f0 fixes timeout param in netconf provider for junos (#18634)
This change will now cause the netconf provider to honor the module
timeout value when making calls to pyez.
(cherry picked from commit a757a77159)
2016-11-26 22:25:37 -05:00
Peter Sprygada
4d7760c0b1 pass module timeout value to fetch_url in eapi connection (#18633)
This change causes the eapi connection to honor the module timeout
value when calling fetch_url
(cherry picked from commit eec6980f3e)
2016-11-26 22:23:43 -05:00
Alberto Murillo
b9a1b2836a Fix ssh plugin to correctly fetch files when using scp (#18614)
Fetch module uses fetch_file() from plugin/connection/ssh.py to
retrieve files from the remote hosts which in turns uses
_file_transport_command(self, in_path, out_path, sftp_action) being
sftp_action = 'get'

When using scp rather than sftp, sftp_action variable is not used
and the scp command is formed in a way that the file is always
sent to the remote machine

This patch fixes _file_transport_command() to correctly form the scp
swaping src and dest if sftp_action is 'get'

Bug introduced at 8e47b9b
Fixes #18603

Signed-off-by: Alberto Murillo Silva <alberto.murillo.silva@intel.com>
(cherry picked from commit ec2521f6af)
2016-11-26 17:01:53 -06:00
Toshio Kuratomi
8dee7f3138 Update core submodule for mount on BSD's fix 2016-11-23 13:27:16 -08:00
Michael Schuett
f4a2332d48 Fix auth in collins.py inventory
This forces basic auth to be used. Using the normal HTTPPasswordMgrWithDefaultRealm
password manager from urllib2 fails since collins doesn't send a 401 retry on failure.
More about this can be seen here http://stackoverflow.com/questions/2407126/python-urllib2-basic-auth-problem.
I added a small comment about the format of the host so others don't waste time like i did.

(cherry picked from commit 21813ed83e)
2016-11-23 14:39:37 -05:00
James Cammarata
a60a7279d0 Look for _get_parent_attribute method in both src and dst dict
When determining which getter style to use for the object in question,
the BaseMeta class should look at both dict's to try and locate the method.

Fixes #18522

(cherry picked from commit 4859e0a419)
2016-11-23 12:51:54 -06:00
Toshio Kuratomi
f1f6752686 Add mount module fixes to changelog
Add Py3 fixes to changelog
2016-11-23 07:27:55 -08:00
Toshio Kuratomi
42e0efbbbf Update submodule refs 2016-11-23 07:24:44 -08:00
Toshio Kuratomi
ac076dfc12 Fix the Solaris POSIX acl fix
For setfacl on Solaris we need to specify permissions like r-x.
For chmod, we need to specify them as rx (r-x means to make the file
readable and *not* executable)

(cherry picked from commit 255a5b5d75)
2016-11-22 12:38:06 -08:00
Toshio Kuratomi
0bed5d4d85 Update core submodule ref for another py3 fix 2016-11-22 11:45:23 -08:00
Toshio Kuratomi
b39f48121d Update submodule refs 2016-11-22 11:27:44 -08:00
koralsky
bf8902f371 import reduce from six label:python3 (#18561)
* import 'reduce' from six
* import reduce in facts fix

(cherry picked from commit 4e194d71bd)
2016-11-22 11:23:57 -08:00
Michael Noseworthy
27be8a1022 Fix unicode handling in fixup_perms2 errorhandling (#18565)
The _fixup_perms2 method checks to see if the user that is being sudo'd
is an unprivileged user or root. If it is an unprivileged user, some
checks are done to see if becoming this user would lock the ssh user out
of temp files, among other things. If this check fails, an error prints
telling the user to check the documentation for becoming an unprivileged
user.

On some systems, the stderr prints out the unprivileged user the ssh
user was trying to become contained in smartquotes. These quotes aren't
in the ASCII range, and so when we're trying to call `str.format()` to
combine the stderr message with the error text we get a
UnicodeEncodeError as python can't coerce the smartquotes using the
system default encoding. By calling `to_native()` on the error message
we can ensure that the error message is a native string for the
`Exception` handling, as `Exception` messages need to be native strings
to avoid errors (byte strings in python2, and text strings in python3)

Fixes: #18444
(cherry picked from commit bb5d8fb476)
2016-11-22 11:20:21 -08:00
Toshio Kuratomi
f62224497e Fix setfacl for Solaris with POSIX acl support.
Tested on Linux and freebsd.

Fixes #17919

(cherry picked from commit d90638ad40)
2016-11-21 13:25:23 -08:00
James Cammarata
529adb574a Cache dynamically included blocks for later lookup via uuid
Fixes #18357

(cherry picked from commit 7e2305f953)
2016-11-21 13:05:14 -06:00
James Cammarata
528426ce0c Check for negative defined logic in conditionals
(cherry picked from commit 8ee3ef587a)
2016-11-21 12:22:56 -06:00
James Cammarata
a34793d7fb When iterating over hostvars yield the hostname not the host object
Also fixes HostVars to raise the correct jinja2 error type.

Fixes #16836

(cherry picked from commit 0df3767d4d)
2016-11-21 12:22:56 -06:00
Toshio Kuratomi
a91788e25a Convert playbook basedir into unicode at the borders
(cherry picked from commit 0b96d61162)
2016-11-21 09:25:22 -08:00
Brian Coca
74bb122598 change to ~ instead of $HOME to avoid undefined (#18551)
fixes #16032
(cherry picked from commit 6dece90a57)
2016-11-21 07:36:15 -08:00
Andrea Tartaglia
66779698f0 Replaced iterkeys with 'for key in dict' for #18507 (#18538)
(cherry picked from commit 62697ad77f)
2016-11-21 07:19:32 -08:00
James Cammarata
d4e8cdc84f New release v2.2.1.0-0.1.rc1 2016-11-18 23:56:46 -06:00
James Cammarata
ead92bee3d Updating CHANGELOG for 2.2.1 release 2016-11-18 23:53:04 -06:00
James Cammarata
23b5764b57 Properly sort groups by name as well as depth when getting vars
Fixes #17243
2016-11-18 22:56:37 -06:00
James Cammarata
3ce19f4c58 With role params also keep special params in the ds as well as params
With 2.0, we decided to create a special list of param names which were
taken out of the role data structure and stored as params instead (connection,
port, and remote_user). This causes problems with inheritance of these params,
so we are now deprecating that while also keeping those keys in the ds so they
are brought in as attributes on the Role correctly.

Fixes #17395

(cherry picked from commit f36926f8d3)
2016-11-18 22:20:08 -06:00
Toshio Kuratomi
585c57fca4 Update submodule refs 2016-11-18 12:47:36 -08:00
Ben Cordero
aed616ab31 openstack: iterate through nova addresses with six (#18408)
(cherry picked from commit a9a2f12adb)
2016-11-18 12:45:55 -08:00