Commit graph

27698 commits

Author SHA1 Message Date
James Cammarata
dd0257b995 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
2016-12-21 10:09:06 -06:00
Brian Coca
7faa041636 added file flag preservation to atomic_move
preserves existing flag info if possible
2016-12-21 10:56:40 -05:00
Felix Frank
a999452b68 add minimum version for the json_query filter
The documentation did not at all specify that the `json_query` filter
was not available in earlier versions.
2016-12-21 09:50:54 -05:00
Brian Coca
3691c784d2 fix check mode for all options
also simplified code paths and changed import away from *
fixes #19476
2016-12-21 09:36:46 -05:00
Jiri Tyr
91094ec96c Adding ldap_entry module (#19285)
* Adding ldap_entry module

* Introducing explicit option for LDAP attributes

* Fixing requirements of attributes option
2016-12-21 07:37:28 +01:00
Nehal J Wani
e907622121 jenkins_plugin: doc: Specify version as string (#18858)
If the plugin version expected is, say '1.20', then specifying it
as...
    version: 1.20
... will make the YAML parser interpret it as a float, and the
value obtained by the module will be 1.2 instead of 1.20, which
will cause downloading of wrong version of the module.

This patch updates the docs so that users don't face this issue.
2016-12-21 07:32:23 +01:00
Brian Coca
8c5d321a23 simplified unsafe writes 2016-12-20 15:54:10 -05:00
Adrian Likins
727ca6f436 Fix error on 'help module' in ansible-console (#19390)
If 'help xattr' for example, ansible-console would
traceback because module_docs.get_docstring() now
returns 4 values (module metadata was added)
2016-12-20 15:50:29 -05:00
Brian Coca
ebf835045f unique error messages to avoid confusion 2016-12-20 15:25:59 -05:00
Adrian Likins
ab560df15f Fix 3 char indent on AnsibleModule._unsafe_writes (#19542) 2016-12-20 10:36:17 -05:00
Adrian Likins
388510f379 Fix missing imports from sysctl module
This module was missing an import of get_exception()
and had an unused import of 're'
2016-12-20 10:23:48 -05:00
Matthew Gamble
8292cadc7f Tell pacman not to display progress bars
Displaying progress bars is not recommended for any scripted usage of
pacman, such as the ansible pacman module.
2016-12-20 09:47:25 -05:00
Ganesh Nalawade
c3c4ae87dd Add 'update' parameter in junos_config module (#19038)
* Fix # #5839 Add 'update' parameter in junos_config module

Add update parameter in junos_config module which supports
configuration action like merge, replace and overwrite.

* Fix documentation issue

* Fix review comment to add replace argument

Make replace and update argument mutually
exclusive, to support replace for backward
compatibility.
2016-12-20 07:27:26 -05:00
Peter Sprygada
f831ef692c update signature in network plugin (#19545)
Fix call to _update_module_args() to include module_name in the args
2016-12-20 07:07:42 -05:00
Ken Evensen
bcace3cfc4 Gconf2 module (#19540)
* Pull #19267 broke sysctl module.  Minor corrections

* Correct description.  Functional updates
2016-12-20 11:53:49 +00:00
tmshn
112d950794 [timezone module] Check if timedatectl command is actually available 2016-12-19 21:18:12 -05:00
Michael Herold
a532dd915a Adds description for ini_file "section: null" 2016-12-19 21:10:30 -05:00
Matthew Gamble
f24ab68f04 Improve and optimise pacman package installation
Previously, packages were installed one at a time in a loop. This caused
a couple of problems.

First, it was a performance issue - pacman would have to perform all of
its checks once per package. This is unnecessarily costly, especially
when you're trying to install several related packages at the same time.

Second, if a package you're trying to install depends on a virtual
package that is provided by several different packages (such as the
"libgl" package on Arch) and you aren't also installing something that
provides that virtual package at the same time, pacman will produce an
interactive prompt to allow the user to select a relevant package. This
is obviously incompatible with how ansible operates. Yes, this problem
could be avoided by installing packages in a different order, but the
order of installation shouldn't matter, and there may be situations
where it is not possible to control the order of installation.

With this refactoring, all of the above problems are avoided. The code
will now work out all of the packages that need to be installed from any
configured repositories and any packages that need to be installed from
local files, and then install all the repository packages in one go and
then all of the local file packages in one go.
2016-12-19 21:09:25 -05:00
Dag Wieers
93cfe73a76 Report detailed error when internal remote functions fail
This is a redesign in how plugins call _remote_checksum().

- _remote_stat() has been modified to report the real error as
  AnsiblError
- Action plugin **unarchive** calls _remote_stat() directly instead of
   _remote_checksum()
- Action plugin **unarchive** also handles the exceptions directly
- Ensure get_exception() returns native text

Two other action plugins, **template** and **fetch**, also do a remote checksum.
In **template** we already call _remote_stat(), just like we now do for
unarchive, in **fetch** we do call _remote_checksum() and we make the
exact same mistake as the unarchive plugin. So that one could use a
redesign as well.

This fixes #19494

Before:
```
[dag@moria ansible.testing]$ ansible-playbook -v test137.yml
Using /home/dag/home-made/ansible.testing/ansible.cfg as config file

PLAY [localhost]
******************************************************************************************************

TASK [unarchive]
******************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"python isn't present on the system.  Unable to compute checksum"}

PLAY RECAP
******************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0
failed=1
```

After:
```
[dag@moria ansible.testing]$ ansible-playbook -v test137.yml
Using /home/dag/home-made/ansible.testing/ansible.cfg as config file

PLAY [localhost]
*************************************************************************************************************

TASK [unarchive]
*************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"Failed to get information on remote file (/tmp/): sudo: unknown user:
foobar\nsudo: unable to initialize policy plugin\n"}

PLAY RECAP
*******************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0
failed=1
```
2016-12-19 21:04:48 -05:00
Adrian Likins
2597c1236d Better error msg for basic.get_bin_path()
Include the searched paths in the error message.
2016-12-19 20:55:52 -05:00
Adrian Likins
35fef6fb84 Better error message for module unsupported params
Keep track of all the unsupported parameters, and include
all of them in the error message as well as a list of the
supported params.
2016-12-19 20:47:39 -05:00
Matt Clay
cdd74b2b84 Fix foreman compile skip path. 2016-12-19 14:55:53 -08:00
Fabio Alessandro Locati
06abeea5ad Improve YAML examples - windows/win_package.py (#19407)
* Improve YAML examples - windows/win_package.py

* Fix quote

* Fix typo
2016-12-19 13:58:28 -08:00
Fabio Alessandro Locati
3c64ccd6e1 Make examples in YAML format - windows/win_acl.py (#18836)
* Make examples in YAML format - windows/win_acl.py

* Raw string
2016-12-19 13:57:21 -08:00
Peter Sprygada
c546c12b60 fixes incorrect module name for action plugin (#19535)
This fixes a bug introduced in the action plugin for setting the
module name value for logging
2016-12-19 16:54:31 -05:00
Rezart Qelibari
507b96ff30 user: make system=yes work on Darwin systems. (#19464)
* Update system/user.py module.

Add ability to add real system users with next free system uid (< 500) on macOS.

* Improve syntax in system/user.py module.

Remove complex if else line and replace by simple comparison which yields the same boolean value.

* Remove "True" comparison of user.py.

Remove comparison to true, as it is not pep8 conform.
2016-12-19 16:35:56 -05:00
Chris Houseknecht
71685b3258 Update module_args['rsync_opts'] when connection type is docker (#19531) 2016-12-19 16:08:31 -05:00
Brian Coca
9816addcdc removed too generic 'infrastructure' 2016-12-19 15:25:39 -05:00
Brian Coca
e542976bb7 removed redundant else/return 2016-12-19 15:11:29 -05:00
Brian Coca
cb55e74487 added update to ansible-doc as minor feature 2016-12-19 15:10:52 -05:00
Toshio Kuratomi
226124956c Allow timeout decorator to handle @timeout as well as @timeout() 2016-12-19 15:09:50 -05:00
Brian Coca
b4bd6c80de fixes to facts timeout
also now handle timeout exception correctly everywhere
2016-12-19 15:09:50 -05:00
Brian Coca
f533f6603c show filename for module 2016-12-19 14:48:19 -05:00
Toshio Kuratomi
c46ef98496 Replace the old ansible.module_utils best practices with the new ones. 2016-12-19 11:11:55 -08:00
Rob
cfa8ce767b Add new parameters to taskdefinition module - network_mode and task_r… (#19493)
* Add new parameters to taskdefinition module - network_mode and task_role_arn

* Add version_added field for doco

* Change version_added parameter to 2.3
2016-12-19 18:16:35 +00:00
Fabio Alessandro Locati
a080d44a47 Improve YAML examples - system/solaris_zone.py (#19410) 2016-12-19 16:49:47 +00:00
Peter Sprygada
7814546735 cast injected json string to bytes in local modules (#19519)
this change will cast the locally injected ansible args to bytes
from string
2016-12-19 11:34:18 -05:00
Peter Sprygada
2a5a2773c8 adds new module net_command for network devices (#19468)
* new module net_command for sending a command to a network device
* adds unit test cases for module
* only works with connection=network_cli
2016-12-19 11:21:37 -05:00
Rob
b77ab1a6c9 Add support to ec2_eip to associate with a secondary ip address (#19484) 2016-12-19 15:45:38 +00:00
Ken Evensen
58b067532f gconftool2 module (#19461)
* Pull #19267 broke sysctl module.  Minor corrections

* Commit of gconftool2 module
2016-12-19 14:57:31 +00:00
Alex Sergeyev
28a3a13656 Support MariaDB engine version 10.1 (#19483) 2016-12-19 14:28:29 +00:00
redbloodmage
0568adc272 Added some clarity on the token confusion. (#19473) 2016-12-19 13:42:31 +00:00
Peter Sprygada
8f97ddd98a removes network os guess static method (#19467)
For devices that do not support mutliplexing, we cannot automatically
determine the network os.  This removes the os guess static method
from the terminal plugin.  For this devices, the network_os
value must be configured
2016-12-19 07:47:29 -05:00
Matthew
c58461596a Support pacman packages using different types of compression (#19503)
It's possible to compress packages using several different compression
methods, or not compressed at all. Previously, the pacman module only
supported files compressed using xz. This update ensures that all
compression types currently supported by pacman are supported by the
ansible pacman module.

The list of supported compression methods at the time of writing can be
found here:
https://git.archlinux.org/pacman.git/tree/scripts/makepkg.sh.in#n747
2016-12-19 12:08:45 +00:00
Will Thames
87c0c33241 Fix include_role docs to be valid YAML (#19506)
Remove the colon from one of the documentation notes, which was
causing documentation schema validation to fail.
2016-12-19 10:45:01 +00:00
Will Thames
dce445f956 Improve error message for module validation (#19501)
Print out the data that fails to validate when doing
schema checking on modules

This allows easier interpretation of error messages.

From:

```
ERROR: DOCUMENTATION.notes.2: expected basestring
```

To:

```
ERROR: DOCUMENTATION.notes.2: expected basestring @ data['notes'][2].
Got {"As with C(include) this task can be static or dynamic, If static
it implies that it won't need templating nor loops nor conditionals and
will show included tasks in the --list options. Ansible will try to
autodetect what is needed, but you can set `static": 'yes|no` at task
level to control this.'}
```
2016-12-19 08:49:18 +00:00
Brian Coca
48dee1b6d0 still needs static for task object 2016-12-16 23:52:11 -05:00
Dag Wieers
39c9c6b942 Ensure that command/shell errors are displayed
This fix ensures that if there are specific module errors (in our case
the python interpreter was not found) then command and shell returns a
proper error.

It also fixes a few other imperfections that we noticed during
troubleshooting:

- Return the real RC if it were available
- Improve a dictionary evaluation using .get()
- Return an RC of -1 if it is unknown (instead of returning 0)

This fixes #18846
2016-12-16 21:46:02 -05:00
Dag Wieers
41614fd8e6 Display proper error on group_vars syntax error
This fix ensures a proper error is shown when a group_vars files cannot
be parsed correctly. Without this patch you get:

```
[dag@moria ansible.testing]$ ansible-playbook test132.yml
ERROR! Unexpected Exception: dictionary update sequence element #0 has length 1; 2 is required
to see the full traceback, use -vvv
```

With this patch you get:
```
[dag@moria ansible.testing]$ ansible-playbook test132.yml
ERROR! Problem parsing file '/home/dag/home-made/ansible.testing/group_vars/test135': line 1, column 1
```

This fixes #18843
2016-12-16 21:13:41 -05:00
Brian Coca
5d82fe545f minor docs and option fixes 2016-12-16 16:17:52 -05:00