Commit graph

7334 commits

Author SHA1 Message Date
Matt Clay
2dc8d80dc5 Update submodule refs. 2016-08-05 11:32:48 -07:00
James Pic
d2438b6b6b Debug output callback (#16839)
* Added debug output callback

* Better import

* Comment on line
2016-08-05 13:57:13 -04:00
Toshio Kuratomi
408664b532 Update submodule refs 2016-08-05 10:26:27 -07:00
James Cammarata
1714279b5e Tweak the way the debug strategy imports the linear strategy parent
Due to the way we load plugins, internally to Python there can be issues when
the debug strategy is loaded after the linear strategy. To work around this,
we're changing the import line for the linear strategy to avoid the problem.

Related to #16825
2016-08-05 10:06:50 -05:00
Toshio Kuratomi
6db6edfc4f YAML treats some unquoted strings as booleans. For instance, (#16961)
uri:
    follow_redirects: no

Will lead yaml to set follow_redirects=False.  This is problematic when
the module parameter is not a boolean value but a string.  For instance:

  follow_redirects = dict(required=False, default='safe', choices=['all', 'safe', 'none', 'yes', 'no']),

Our parameter validation code ends up getting follow_redirects="False"
instead of "no".  The 100% fix is for the user to quote their strings in
playbooks like:
  uri:
    follow_redirects: "no"

But we can fix quite a few common cases by trying to switch "False" back
into the string that it was specified as.  We only do this if there is
only one correct choices value that could have been specified.  In the
follow_redirects example, a value of "True" only maps back to "yes" and
a value of "False" only maps back to "no" so we can do this.  If choices
also contained "on" and "off" then we couldn't map back safely and would
need to force the module author to change the module to handle this
case.

Fixes parts of the following PRs:

* https://github.com/ansible/ansible-modules-core/pull/4220
* https://github.com/ansible/ansible-modules-extras/pull/2593
2016-08-05 06:49:34 -07:00
Toshio Kuratomi
1ecf51d87e * Fix race in creating temp directories pre-fork (#16965)
* These can still race when multiple ansible processes are created at
    the same time.
* Reverse order of expanduser and expandvars in unfrakpath(). So that
  tildes in environment variables will be handled.
2016-08-04 19:35:36 -04:00
Matt Davis
746ea64d30 fix for unspecified retries on until + test (#16963)
fixes #16907
2016-08-04 19:20:45 -04:00
Brian Coca
bced8715cd add transparent vault use to other plugins (#16957)
assemble, script and unarchive (copy already had it).
2016-08-04 18:35:30 -04:00
Will Thames
eb2a3a91a8 task_result _check_key should handle empty results (#16766)
When a task result has an empty results list, the
list should be ignored when determining the results
of `_check_key`. Here the empty list is treated the
same as a non-existent list.

This fixes a bug that manifests itself with squashed
items - namely the task result contains the correct
value for the key, but an empty results list. The
empty results list was treated as zero failures
when deciding which handler to call - so the task
show as a success in the output, but is deemed to
have failed when deciding whether to continue.

This also demonstrates a mismatch between task
result processing and play iteration.

A test is also added for this case, but it would not
have caught the bug - because the bug is really in
the display, and not the success/failure of the
task (visually the test is more accurate).

Fixes ansible/ansible-modules-core#4214
2016-08-04 17:13:33 -05:00
Ryan Brown
4f7996fbc1 Merge pull request #16879 from alikins/gce_module_utils
Fix import of gce/gcdns without a libcloud module
2016-08-04 16:16:01 -04:00
James Cammarata
159aa26b36 FEATURE: adding variable serial batches
This feature changes the scalar value of `serial:` to a list, which
allows users to specify a list of values, so batches can be ramped
up (commonly called "canary" setups):

- hosts: all
  serial: [1, 5, 10, "100%"]
  tasks:
  ...
2016-08-04 15:04:10 -05:00
ovcharenko
f326e49d75 Fix for issue @synchronize doesn't substitute variables properly #16347 (#16349)
* Fix for issue @synchronize doesn't substitute variables properly #16347
2016-08-04 11:27:44 -07:00
Hidetoshi Hirokawa
595946b80e Fix the security rules name duplication of azure_rm_common. (#16897) 2016-08-04 10:43:30 -07:00
victoru
14901b65d9 raise AnsibleError in hashi_vault lookup plugin when hvac module is not installed (#16859) 2016-08-04 10:06:12 -07:00
Brian Coca
7ea56e1c79 optimize booleanifycation 2016-08-04 11:32:26 -04:00
Brian Coca
b0786a1845 actually skip bad/broken module files found 2016-08-04 11:32:08 -04:00
Brian Coca
98c149859a added y/n to list of module booleans 2016-08-04 10:47:05 -04:00
Brian Coca
27691991c3 refactored ethtool data to allow for other callers 2016-08-04 10:41:50 -04:00
Brian Coca
f7570f1dc4 Implicit localhost ondemand (#16900)
* Revert "There can be only one localhost"

This reverts commit 5f1bbb4fcd.
this broke several usages of localhost, see #16882, #16898 and #16886

* ensure there is only 1 localhost

fixes #16886, #16882 and #16898

- make sure localhost exists before returning it
- optimzed host caching
- ensure we always return a host object
2016-08-02 10:39:00 -04:00
Brian Coca
123d54e736 added pid to backup file name to avoid collisions 2016-07-29 23:04:57 -04:00
Adrian Likins
36bf1e6b7e Fix funcd to at least import without errors. (#16288)
This plugin was using very old api, so was
updated to newer api.

Also misc style/pep8 cleanups.
2016-07-29 16:19:38 -04:00
Adrian Likins
fa1d55f683 Fix import of gce/gcdns without a libcloud module
The module level function defs for gcdns_connect() and
gce_connect() provide a default arg for 'provider' that
references into the libcloud module. If the libcloud
modules were not installed, the gce/gcdns python modules
would throw ImportError.

Let the provider arg default to None and if not provided,
set it to the default libcloud.compute.types.Provider.*
value if the modules are installed.
2016-07-29 13:34:09 -04:00
Ryan S. Brown
bed24689ec Fix syntax error in json/jsonarg type parser
The lack of a comma caused the statement to always evaluate as a
`TypeError` when python interpreted `value (list, tuple, dict)` to call
value with the arguments list, tuple, and dict.
2016-07-28 15:54:09 -04:00
William Albert
409d95d67e Refactored gce util module to support other GCP services (#15924)
This is a refactoring of the existing GCE utility module to support other projects on Google Cloud Platform.

The previous gce.py module was hard-coded specifically for GCE, and attempting to use it with other projects in GCP failed.

See https://github.com/ansible/ansible/pull/15918#issuecomment-220165913  for more detail.

This has also been an issue for others in the past, although they've handled it by simply
duplicating some of the logic of gce.py in their own modules.

-   The existing gce.py module was renamed to gcp.py, and modified to remove any 
     imports or other code that refers to libcloud.compute or GCE (the GCE_* params were
     retained for compatibility). I also renamed the gce_connect function to gcp_connect, 
     and modified the function signature to make supplying a provider, driver, and agent 
     information mandatory.

-  A new gce.py module was created to handle connectivity to GCE. It imports the
   appropriate libcloud.compute providers and drivers, and then passes them on
   to gcp_connect in gcp.py. The constants and function signatures are the same
   as the old gce.py, so compatibility with existing modules is retained.

- A new gcdns.py module was created to support PR ansible/ansible-modules-extras#2252
  for two new Google Cloud DNS modules, and to demonstrate support for a non-GCE 
  Google Cloud service. It follows the same basic structure as the new gce.py module,
  but imports from libcloud.dns instead.
2016-07-28 12:54:39 -04:00
Lukas Pirl
a9aea3c6d4 (re)allow ansible_python_interpreter to contain more than 1 arg (#16247) 2016-07-26 07:46:16 -07:00
Brian Coca
92870ee996 jsonarg bikeshed to json, arg type implies 'arg' 2016-07-26 09:50:21 -04:00
Brian Coca
4e14b7b783 warn when searching for an empty string or null 2016-07-26 08:26:07 -04:00
Toshio Kuratomi
04a60a1db4 Update submodule refs 2016-07-26 05:22:59 -07:00
Toshio Kuratomi
7e54c9a468 No longer try to import __version__ from release.py. (#16817)
I'm not sure why that would be desirable -- we really want __version__
to come from the controller whereas importing will come from the client
node.  If it turns out there was a reason to do that, please be sure to
use an exception handler that catches all exceptions instead of only
catching ImportError:

```
try:
    from ansible.release import __version__, __author__
except:
    __version__ = [...]
```

Fixes #16523
2016-07-25 11:16:27 -07:00
Toshio Kuratomi
eb3bdcb9e3 Update submodule refs 2016-07-25 06:32:25 -07:00
Brian Coca
e2f17f8d9b set cwd to task's basedir (#16805)
* switch cwd to basedir of task

This restores previous behaviour in pre 2.0 and allows for 'local type' plugins
and actions to have a more predictable relative path.

fixes #14489

* removed FIXME since prev commit 'fixes' this

* fix tests, now they need a loader (thanks jimi!)
2016-07-25 08:11:45 -04:00
Brian Coca
363596c67f added check and diff mode control to console
also expanded mk_boolean to allow for 'on/off'
fixes #16815
2016-07-25 08:05:56 -04:00
Joe (rook)
2219339dd5 Adding ethtool info to Ansible interface facts (#16513)
This will give the user details on how the interfaces are configured.
They user could query to see if TSO, GSO, etc are enbaled
on an interface.
2016-07-24 21:39:47 -04:00
Brian Coca
7fdbfd490e allow include_vars to namespace imports 2016-07-24 21:31:11 -04:00
James Cammarata
a9ff363ead Merge pull request #16779 from mirskifa/devel
Make returning results after loading vars optional
2016-07-24 08:32:18 -05:00
Matt Martz
4065acc37d indent callback output if using 3verbosity or higher (#16231) 2016-07-23 18:10:53 -04:00
Alexandre Garnier
ba2d1d0bc4 Colorize around text (#16415)
Avoid to colorize separately `lead`, equals sign and `num` and separate
them by coloring characters.
2016-07-23 18:09:20 -04:00
Robin Roth
2b28beb1d7 add check_mode option for tasks (#16056)
* add check_mode option for tasks

includes example testcases for the template module

* extend check_mode option

* replace always_run, see also proposal rename_always_run
* rename always_run where used and add deprecation warning
* add some documentation

* have check_mode overwrite always_run

* use unique template name to prevent conflicts

test_check_mode was right before, but failed due to using the same filename as other roles

* still mention always_run in the docs

* set deprecation of always_run to version 2.4

* fix rst style

* expand documentation on per-task check mode
2016-07-22 20:40:14 -04:00
Brian Coca
71c97685a1 fixes for service module interaction with systemd (#16720)
now systemd will run even if service module is inovked with parameters that it does not support
these will be removed before invoking systemd and issue a warning.

this facility will work for any new service modules.
2016-07-22 20:35:20 -04:00
nyasukun
adea1f2b80 fixed memoryerror when coping huge file (#16392)
* fixed

* support both python 2 and 3
2016-07-22 09:06:06 -04:00
Toshio Kuratomi
84c1697271 Only show the traceback for importing cryptography when in Ansible Debug. (#16795) 2016-07-22 05:40:43 -07:00
Toshio Kuratomi
15cee34f9e Update submodule refs 2016-07-21 11:09:22 -07:00
s-hertel
7e834f4178 Fixes #163 in galaxy-issues 2016-07-21 14:04:17 -04:00
Toshio Kuratomi
48a2773463 Find places where ziploader is used and change them to ansiballz so that people aren't confused when they google for information.information (#16715) 2016-07-21 10:58:24 -07:00
Alex Mirski-Fitton
7dc09adaf4 Make returning results after loading vars optional
Reinstates some functionality removed by commit 0ba9a6a but
makes the expensive operation optional (and default to off)
2016-07-21 14:25:57 +01:00
Shintaro Kaneko
372018dfce Fix typo in lib/ansible/parsing/__init__.py (#16761) 2016-07-20 18:03:50 -04:00
Connor Osborn
b06c61c49b Fix exceptions thrown from cryptography import (#16723)
A simple import of cryptography can throw several types of errors. For example,
if `setuptools` is less than cryptography's minimum requirement of 11.3, then
this import of cryptography will throw a VersionConflict here. An earlier case
threw a DistributionNotFound exception.

An optional dependency should not stop ansible. If the error is more than
an ImportError, log a warning, so that errors can be fixed in ansible or
elsewhere.
2016-07-20 03:32:23 -07:00
James Cammarata
d8a3feb976 Fix bug where getting role vars does not follow the dep chain
This bug was introduced in 3ced6d3, where getting vars from a role
did not follow the dep chain. This was originally hidden by the fact
that we got vars twice (from the block and from the roles directly).

Fixes #16729
2016-07-19 16:59:11 -04:00
Peter Sprygada
e4b3032231 removes methods to write to dest from net_config 2016-07-15 17:34:46 -04:00
Peter Sprygada
c4e2c0f487 Merge pull request #16728 from privateip/netcfg
minor update to the default comment tokens in netcfg
2016-07-15 16:42:51 -04:00