Commit graph

21109 commits

Author SHA1 Message Date
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
Toshio Kuratomi
b25c06725a Update submodule refs 2017-01-04 10:17:05 -08:00
Adrian Likins
22f7ca8c97 Add a encode() to AnsibleVaultEncryptedUnicode (#19840)
* Add a encode() to AnsibleVaultEncryptedUnicode

Without it, calling encode() on it results in a bytestring
of the encrypted !vault-encrypted string.

ssh connection plugin triggers this if ansible_password
is from a var using !vault-encrypted. That path ends up
calling .encode() instead of using the __str__.

Fixes #19795

* Fix str.encode() errors on py2.6

py2.6 str.encode() does not take keyword arguments.

(cherry picked from commit c771ab34c7)
2017-01-04 12:17:38 -05:00
James Cammarata
a0a2392c87 Fixing an iteration bug introduced by fed079e4
(cherry picked from commit ac00c8a660)
2017-01-04 10:34:38 -06:00
Toshio Kuratomi
3c4ac877f6 Fix traceback on Darwin with Python3
os.write() needs bytes objects on python3 while python2 can work with
either a byte or unicode string.  Mark the DUMMY_CA_CERT string as
a byte string so it will work.

Fixes #19265
Fixes #19266
2017-01-04 00:34:52 -08:00
Matt Clay
38bf7ab71f Use newer test images for Fedora and openSUSE. 2017-01-03 13:56:53 -08:00
James Cammarata
47e16bef08 Fix role completion detection problem
When the same role is listed consecutively in a play, the previous role
completion detection failed to mark it as complete as it only checked to
see if the role changed.

This patch addresses that by also keeping track of which task in the role
we are on, so that even if the same role is encountered during later passes
the task number will be less than or equal to the last noted task position.

Related to #15409

(cherry picked from commit fed079e4cb)
2017-01-03 14:33:11 -06:00
Arne Demmers
e05222a4cc Fix key lookup in gather facts flag.
(cherry picked from commit bd7466d56c)
2017-01-03 13:53:33 -05:00
Antonio Huete Jimenez
32dad09d2e Check for DragonFly BSD as well for DATE
(cherry picked from commit b9e4a4dede)
2017-01-02 12:59:28 -05:00
Brian Coca
a04d0f485b warn when examined group_vars is not dir
(cherry picked from commit 6f5ecb7efd)
2017-01-02 12:59:28 -05:00
Matt Davis
7683715caf fix multiple handler notifications
Fixes #19647
Adds integration test to catch multiple handler notifications
(cherry picked from commit c2495677b0364d7e31dfcb51865976ba46586732)
2016-12-23 09:48:23 -08:00
James Cammarata
3c7987f3a4 Removing print debug statements
(cherry picked from commit 78d4f6bbc1)
2016-12-22 19:14:53 -06:00
Gordon Gao
3e72e0c173 let chdir support relative path in more modules (#16736)
(cherry picked from commit d9e1e374b2)
2016-12-22 00:21:30 -08:00
James Cammarata
10a3053525 Correctly set loader path when using list tags/tasks
Fixes #19398

(cherry picked from commit b688f11474)
2016-12-21 21:04:57 -06:00
bart2
29762c87c8 Fixes #16936 - Digest authentication not working in uri module (#18736) 2016-12-21 18:15:21 -08:00
James Cammarata
477043c422 Wrap unhandled errors from lookups in an AnsibleError
This provides better error handling, and prevents errors like KeyError
from bubbliing up to code in odd places.

Fixes #17482

(cherry picked from commit 85bbce9d6b)
2016-12-21 11:49:26 -06:00
James Cammarata
f89abc705b Also fix default callback to use ignore_errors param
Rather than the value in the task, which may not be templated.

Related to #18289

(cherry picked from commit d70d279c4e)
2016-12-21 11:37:25 -06:00
James Cammarata
2d8ebbfe8c Template "original_task" fields in _process_pending_results
Since we no longer use a post-validated task in _process_pending_results, we
need to be sure to template fields used in original_task as they are raw and
may contain variables.

This patch also moves the handler tracking to be per-uuid, not per-object.
Doing it per-object had implications for the above due to the fact that the
copy of the original task is now being used, so the only sure way is to track
based on the uuid instead.

Fixes #18289

(cherry picked from commit dd0257b995)
2016-12-21 10:11:59 -06:00
Brian Coca
e1b459470d log on target based on nolog, not verbosity
fies #18569

(cherry picked from commit b1cefcf176dea8b3bb2a33aebda0b8f6e4dc6cfb)
2016-12-21 11:09:33 -05:00
Brian Coca
1bdf25561a initialize module name
removing verbosity exposed missing name at certain stages, initialize to file name
and update later once module args are parsed

(cherry picked from commit cea1acf1462a323dea976ecfa0b1a9e403b4e31b)
2016-12-21 11:09:32 -05:00
Brian Coca
b1e44d1195 still needs static for task object
(cherry picked from commit 48dee1b6d0)
2016-12-16 23:52:25 -05:00
Brian Coca
8ad67b44dc removed unused static
backport of #19454
2016-12-16 15:17:39 -05:00
Jake Morrison
cfbb58adae Handle inability to read /proc for ansible_service_mgr. Fixes #18957
(cherry picked from commit 00859a4ced)
2016-12-16 12:28:55 -05:00
Brian Coca
f90a6439c4 correct template lookup path
now all paths get 'templates/'

(cherry picked from commit ed933421fe)
2016-12-16 12:28:55 -05:00
Toshio Kuratomi
d8449b3013 Update submodule refs 2016-12-14 14:42:51 -08:00
Toshio Kuratomi
1168524f22 Change release templates so they work with py3
(cherry picked from 0b440a9289)
2016-12-14 14:42:23 -08:00
Toshio Kuratomi
99472c42e3 Pull in f5 py3 fix 2016-12-14 10:17:03 -08:00
Toshio Kuratomi
00378515e2 * Add test for git with local modifications
(cherry picked from afca957396)

From PR: Fix UnboundLocalError remote_head in git (#19057)
2016-12-14 08:46:11 -08:00
Toshio Kuratomi
2639016847 Update submodule refs for git module fix 2016-12-14 08:45:01 -08:00
Andrea Tartaglia
be07fcc6d9 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506

(cherry picked from commit 59227d8c31)
2016-12-14 08:39:29 -08:00
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