Commit graph

21154 commits

Author SHA1 Message Date
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
Matt Davis
f6b47c53d7 async fix changelog update 2016-11-18 11:50:08 -08:00
Matt Davis
8696ce9e00 bump submodule refs 2016-11-18 11:48:19 -08:00
Matt Davis
d637559825 manual backport of win_async test changes from devel 2016-11-18 11:47:08 -08:00
jamessewell
c2f9846278 Moved the _inventory.clear_group_dict_cache() from creating a group w… (#17766)
* Moved the _inventory.clear_group_dict_cache() from creating a group which doesn't exist, to adding members to the group.

* Update __init__.py

Update to use changed: block to catch all changes for cache clear as suggested

(cherry picked from commit b91d4d884d)
2016-11-18 13:27:52 -06:00
Andrew Haines
35e198a616 Default include_role results to empty list in linear strategy plugin
Fixes #18544.

When a loop is over an empty list, the result is set to

    {'skipped_reason': u'No items in the list', 'skipped': True, 'changed': False}

which means that accessing `hr._result['results']` throws a `KeyError`.

(cherry picked from commit 200d6bdb23)
2016-11-18 12:14:02 -05: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
159399fea4 Return failed instead of raising an error when an include_vars file is missing
Fixes #18508

(cherry picked from commit 937d872f4b)
2016-11-18 09:57:57 -06:00
Adrian Likins
47d5f0f0a8 Fix 'ansible-vault edit' crash on changed nonascii
ansible-vault edit was attempting to decode the file contents
and failing.

Fixes #18428

(cherry picked from commit c09060e8ff)
2016-11-18 10:11:00 -05:00
Brian Coca
bc539adddc added changes from devel needed by systemd fixes 2016-11-18 10:06:12 -05:00
Brian Coca
ecbac4cf73 fix for filter fix
(cherry picked from commit 5d043b65d3)
2016-11-17 13:42:44 -05:00
Brian Coca
1a247de0b6 remove rsync path from returned facts
(cherry picked from commit 7c960d440f)
2016-11-17 13:21:14 -05:00
James Cammarata
30d5d5fa67 Don't fail on missing vars files for delegated hosts
Fixes #17965

(cherry picked from commit f7fe6dc19c)
2016-11-17 11:59:42 -06:00
James Tanner
39cb6797a3 Port has_key to python3 compatible syntax
(cherry picked from commit 2d2bb626d4)
2016-11-16 13:02:46 -08:00
Brian Coca
6f5ec79e91 corrected service filtered option to singular
(cherry picked from commit afaec3da82)
2016-11-16 10:13:02 -05:00
Brian Coca
42fb088807 always template when called from template (#18490)
* Have template action plugin call do_template

Avoids all the magic done for 'inline templating' for ansible plays.
renamed _do_template to do_template in templar to make externally accessible.
fixes #18192

* added backwards compat as per feedback

(cherry picked from commit bd70397e24)
2016-11-15 15:17:06 -05:00
James Cammarata
7602a2a030 Catch loop eval errors and only raise them again if the task is not skipped
This should help on issues like #16222.

(cherry picked from commit 57cf5e431c)
2016-11-15 10:39:27 -06:00
James Cammarata
413f6ab7f1 Add option to prepend inherited attributes when extending values
Fixes #18483

(cherry picked from commit 435ca620b2)
2016-11-14 16:42:46 -06:00
Brian Coca
832cc5bb5b added alias to argumetns 'args' to blacklist
this should fix https://github.com/ansible/ansible-modules-core/issues/5584

(cherry picked from commit f4391d34e4)
2016-11-14 15:19:21 -05:00
Chris Church
28883975bf Increment changed stat for a failed task if changed. (#18014)
(cherry picked from commit 534bd12ae9)
2016-11-14 01:24:01 -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
Matt Clay
0cde6fdaca Add changelog entry for make deb changes. 2016-11-11 13:15:35 -08:00