Commit graph

7125 commits

Author SHA1 Message Date
Toshio Kuratomi
5635670191 Update submodule refs for mount fixes 2016-09-23 14:53:31 -07:00
Abhijit Menon-Sen
cc71765d9e Use loop_control.loop_var directly
6eefc11c converted task.loop_control into an object, but while the other
callers were updated to use .loop_var instead of .get('loop_var'), this
site was overlooked.

This can be reproduced by including with loop_control a file that does
set_fact; a simple regression test along these lines is included.

(cherry picked from commit 950cc26aab)
2016-09-23 10:39:06 -05:00
Peter Sprygada
b5b8a756fc fixes issue with net_template failing unless src argument provided. (#17726)
This fixes an issue where the net_template action will fail if a non
required argument (src) is not provided.

fixes ansible/ansible-modules-core#4978
2016-09-23 09:24:30 -04:00
nitzmahone
4c9ed1f4fb bump extras submodule ref for win_chocolatey fix 2016-09-22 20:09:06 -07:00
Toshio Kuratomi
e917a0bd7a Fix for cherry-pick e8dddc3679,
The cherry-pick allows module parameters to convert int to float, fixing
bugs where a float type is required.  However, it used types from the
six library for python3 compatibility as well.  Since we don't have
six in 2.1.0 this was buggy.  Merging the unittests for the problem
here: adc158a499 made this buggy behaviour
apparent.
2016-09-21 21:45:03 -07:00
Toshio Kuratomi
9de21e1eaa Update submodule refs 2016-09-21 20:41:52 -07:00
Toshio Kuratomi
eaba2152f3 Remove _load_hosts() from Play initialization as it's no longer needed and it breaks using extra_vars defining a list for hosts (#17699)
Thanks to @jimi-c for the solution

Fixes #16583
2016-09-21 20:41:13 -07:00
James Cammarata
01439aafaf Create a raw lookup for hostvars that does not template the data
When using hostvars to get extra connection-specific vars for connection
plugins, use this raw lookup to avoid prematurely templating all of the
hostvar data (triggering unnecessary lookups).

Fixes #17024

(cherry picked from commit ac5ddf4aa092e12f9e1c85c6b74aa30b7ef0a382)
2016-09-21 13:16:58 -05:00
James Cammarata
c004ae578d Take ITERATING_ALWAYS into account when setting failed state in PlayIterator
Fixes #15963

(cherry picked from commit 4dc2bf4815)
2016-09-20 11:31:23 -05:00
James Cammarata
efe5bb122e Rework the way params are assigned to TaskIncludes when they're dynamic
Copying the TaskInclude task (which is the parent) before loading the blocks
makes the code much more simple and clean, and fixes a bug introduced during
the performance improvement changes (and specifically the change which moved
things to a single-parent model).

Fixes #17064

(cherry picked from commit f4237b2151)
2016-09-19 14:29:08 -05:00
René Moser
27c621950c cloudstack: fix has_changed dict values comparsion (#17632)
In some rare situations, the CloudStack API returns string for numbers
when we expected int.

With this fix, we ensure we compare the types expected.
2016-09-19 14:08:21 +02:00
Andrea Tartaglia
7bfa36eb8b Pass the absolute path to dirname when assigning basedir (#17457)
* Pass the absolute path to dirname when assigning basedir

If no path is specified when calling the playbook, os.path.dirname(playbook_path) returns ''
This will cause failure when creating the retry file.

Fixes #17456

* Updated to use os.pathdirname(os.path.abspath())
2016-09-16 08:20:47 -07:00
James Cammarata
fb71a9dfd9 New release v2.1.2.0-0.3.rc3 2016-09-14 16:51:18 -05:00
Jay
d86b2ec225 Fix issue with proxy setting leaving temp files (#17073)
When using the no_proxy option, the temp ca files that are created for
setting up an ssl context were not being deleted. 

This small patch fixes that issue by removing the temp file.
2016-09-13 16:15:48 -04:00
Ryan S. Brown
7ea342d8ec bump core submodule ref 2016-09-13 10:57:53 -04:00
Toshio Kuratomi
6ba8926889 Update submodule refs 2016-09-12 09:02:44 -07:00
nitzmahone
a900a0b4e3 bump core submodule ref 2016-09-11 20:47:31 -07:00
Monty Taylor
c536ca399a Fix galaxy import command for 2.1 (#17417)
The g_connect decorator is required on create_import_task or else
self.baseurl is None. This is fixed in devel already.
2016-09-09 18:04:09 -04:00
Matt Clay
2587d2aaf9 Add partially backwards compatible version of _fixup_perms. (#17427)
Also added a deprecation notice for _fixup_perms.

Resolves issue #17352 (assumes custom actions use recursive=False).

(cherry picked from commit 94a0d2afb4)
2016-09-06 16:56:47 -07:00
James Cammarata
e83840c3fd New release v2.1.2.0-0.2.rc2 2016-08-31 12:57:52 -05:00
Toshio Kuratomi
e8dddc3679 For module parameter checking, allow conversion of int to float (#17325)
Fixes https://github.com/ansible/ansible-modules-core/issues/4084
2016-08-31 09:01:03 -07:00
James Cammarata
da3fd2d588 Several fixes for includes
* when including statically, make sure that all parents were also included
  statically (issue #16990)
* properly resolve nested static include paths
* print a message when a file is statically included

Fixes #16990

(cherry picked from commit 1c7e0c73c9)
2016-08-31 00:09:33 -05:00
Will Thames
c9b212c5bd 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
(cherry picked from commit eb2a3a91a8)
2016-08-29 08:40:38 -07:00
Michael Scherer
478283f571 Do not convert Nonetype to "None" (#17261)
If someone use a task with a empty name like this:

  - name:
    command: true

This will result in displaying 'None' as a task name instead of
'command'.
2016-08-26 09:53:29 -07:00
Remi Ferrand
5035b8a8bf Properly template task names in free strategy
* Fixes #16295
2016-08-26 09:53:20 -07:00
Toshio Kuratomi
0cce86cac9 Fix fetch idempotence (#17255)
Fetch always follows symlinks when downloading so it needs to always
follow symlinks when getting the checksum of the file as well.
2016-08-25 21:53:20 -07:00
James Cammarata
f80c981ef6 Clean up PlaybookExecutor logic for batches and errors
The calculation for max_fail_percentage was moved into the linear
strategy a while back, and works better there in the stategy layer
rather than at the PBE layer. This patch removes it from the PBE layer
and tweaks the logic controlling whether or not the next batch is run.

Fixes #15954

(cherry picked from commit 890e096b2b)
2016-08-25 12:28:08 -05:00
Toshio Kuratomi
7d6df50e0e The former match for a section header included hosts that began with a range. (#17225)
Checking that the line ends with "]" narrows that window somewhat,

Fixes #15331
2016-08-24 10:59:32 -07:00
James Cammarata
b2fe1b39df New release v2.1.2.0-0.1.rc1 2016-08-22 16:15:56 -05:00
Toshio Kuratomi
719c73afa2 Fix tmpfile misspelled as tmplfile (#17183) 2016-08-22 11:32:40 -07:00
James Cammarata
bf929ac532 Backport of f722d41 to the stable-2.1 branch
Related to #15915
2016-08-22 10:21:45 -05:00
nitzmahone
9478e41394 bump extras submodule ref for another win_chocolatey fix 2016-08-17 16:41:00 -07:00
nitzmahone
29dd1635fe bump submodule refs 2016-08-17 15:51:09 -07:00
James Cammarata
ea7a038f6f Don't use an unset playbook basedir when searching for hostgroup vars
The flag new_pb_basedir is not being utilized in Inventory._get_hostgroup_vars,
leading to the situation where an inventory with no playbook basedir set will
read host/group vars from the $CWD, regardless of the inventory and/or playbook
relative location. This patch corrects that by not using the playbook basedir
if it is unset (None).

This patch also corrects a bug in which the VariableManager would accumulate
host/group vars files, which could lead to incorrect vars files being used when
playbooks are run from different directories containing their own group/host vars
directories.

Fixes #16953

(cherry picked from commit b617d62203)
2016-08-17 16:29:13 -05:00
James Cammarata
77fe1ac7af Catch a missing filename in include_vars
Fixes ansible/ansible-modules-core#4445
2016-08-17 09:30:14 -05:00
Nathaniel Case
8312df1512 Relicense netcfg.py to BSD (#17110)
As with #17025. The caveat regarding machilde's (now obsoleted) commit has been addressed, so netcfg.py is able to be easily relicensed.
2016-08-16 16:35:07 -04:00
Brian Coca
2de8d2ece7 make parsed param private and explicit (#17104)
* make parsed param private and explicit

* fixed missed parsed

(cherry picked from commit 5fe9d3c3d5)
2016-08-16 11:59:47 -04:00
David Shrewsbury
d35377dac7 Fix async logic when parsing fails (#17091)
We want to NOT consider the async task as failed if the result is
not parsed, which was the intent of:

  https://github.com/ansible/ansible/pull/16458

However, the logic doesn't actually do that because we default
the 'parsed' value to True. It should default to False so that
we continue waiting, as intended.
(cherry picked from commit bf8c871801)
2016-08-15 13:37:26 -04:00
Brian Coca
616a51ac00 updated submodule refs 2016-08-12 10:48:24 -04:00
nitzmahone
1601e24593 bump core submodule ref to pick up reverted unarchive change 2016-08-11 12:29:30 -07:00
nitzmahone
69d66727ca update core submodule ref 2016-08-11 11:29:01 -07:00
Nathaniel Case
6fe13bbb47 Relicense low-hanging fruit to BSD (#17025) 2016-08-10 10:49:27 -07:00
Toshio Kuratomi
f695dd6892 Fix from @jimi-c to use task_vars when polling async tasks. (#17003)
This is needed so that async_status can use ansible_python_interpreter
for the host being contacted.

Fixes #14101
(cherry picked from commit 38ccd11cce)
2016-08-08 11:07:32 -07:00
Brian Coca
9255a618e3 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!)

(cherry picked from commit e2f17f8d9b)
2016-08-08 13:14:00 -04:00
Matt Clay
cf9ef724e9 Use file list, not recursion, in _fixup_perms. (#16924)
Run setfacl/chown/chmod on each temp dir and file.

This fixes temp file permissions handling on platforms such as FreeBSD
which always return success when using find -exec. This is done by
eliminating the use of find when setting up temp files and directories.

(cherry picked from commit 72cca01cd4)
2016-08-05 18:50:31 -07:00
James Cammarata
f956ff9619 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

(cherry picked from commit 1714279b5e)
2016-08-05 10:08:38 -05:00
Toshio Kuratomi
0000b76a0a 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
(cherry picked from commit 6db6edfc4f)
2016-08-05 06:51:18 -07:00
Toshio Kuratomi
7bd9128848 * 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.
(cherry picked from commit 1ecf51d87e)
2016-08-04 16:43:22 -07:00
Toshio Kuratomi
9f645cdbdb Add the PID of the Ansible process to local_tmp directory. (#16589)
This aids in associating a leftover cachedir with a previous run of
Ansible.  Came about because of #16489
(cherry picked from commit 3f4027f7b4)
2016-08-04 16:40:40 -07:00
Matt Davis
baaa1d3013 fix for unspecified retries on until + test (#16963)
fixes #16907
(cherry picked from commit 746ea64d30)
2016-08-04 19:31:49 -04:00