Commit graph

6929 commits

Author SHA1 Message Date
Matt Martz
ca22783086 modify_module does not need to return module_path, as the calling code already has access to it 2016-05-12 12:53:49 -05:00
Matt Martz
34adb54734 Make _is_binary use already read module_data, move _is_binary check to the top of the stack 2016-05-12 12:53:49 -05:00
Matt Martz
0faddfa168 Move binary module detection into executor/module_common.py 2016-05-12 12:25:09 -05:00
Matt Martz
ddf3c3838f Re-implement/move some code lost due to merge conflicts 2016-05-12 12:25:09 -05:00
Matt Martz
35246abb2e Don't register new vars that aren't needed 2016-05-12 12:25:09 -05:00
Matt Martz
1e038e5043 Update for py26 2016-05-12 12:25:09 -05:00
Matt Martz
0a8d016642 Get binary modules working for windows, assuming .exe for windows 2016-05-12 12:25:08 -05:00
Matt Martz
d8a243bef0 First pass at allowing binary modules 2016-05-12 12:25:08 -05:00
Toshio Kuratomi
4d59779e0a Fixed importing the libcloud modules to give a nice error rather than a traceback. 2016-05-12 09:13:46 -07:00
Vic Iglesias
dac356466c Update GCE module to use JSON credentials (#13623)
* Update GCE module to use JSON credentials

* Ensure minimum libcloud version when using JSON crednetials for GCE

* Relax langauge around libcloud requirements
2016-05-12 08:57:26 -07:00
James Cammarata
d391c53b4f Clear blocked hosts when a role duplicate task is found in free strategy
In the free strategy, we mark a host as blocked when it has work to do
(the PlayIterator returns a task) to prevent multiple tasks from being sent
to the host. However, we check for role duplicates after setting the blocked
flag, but were not clearing that when the task was skipped leading to an
infinite loop. This patch corrects that by clearing the blocked flag when
the task is skipped.

Fixes #15681
2016-05-12 10:38:53 -04:00
James Cammarata
08f6283c3f Merge pull request #15747 from larsks/bug/15744
do not erroneously set gathered_facts=True
2016-05-12 10:22:45 -04:00
James Cammarata
3439bcc744 Merge branch 'refresh-inventory-exit' of https://github.com/zenbot/ansible into zenbot-refresh-inventory-exit 2016-05-12 09:36:12 -04:00
James Cammarata
0d7530e6da Change error about loop variable in use to a warning 2016-05-11 21:50:12 -04:00
Toshio Kuratomi
8a184381af Strip junk after JSON return. (#15822)
Fixes #15601
2016-05-11 17:54:01 -07:00
James Cammarata
9d9a451b34 Simply being in an always block shouldn't mean a host did not fail
Previously the changed code was necessary, however it is now problematic
as we've started using the is_failed() method in other places in the code.
Additional changes at the strategy layer should make this safe to remove
now.

Fixes #15625
2016-05-11 19:13:12 -04:00
James Cammarata
33de7707c9 Do not include params when getting role vars in certain situations
In VariableManager, we fetch the params specifically in the next step,
so including them in the prior step is unnecessary and could lead to things
being overridden in an improper order.

In Block, we should not be getting the params for the role as they are
included earlier via the VariableManager.

Fixes #14411
2016-05-11 13:17:32 -04:00
Toshio Kuratomi
9096901c1f Update submodule refs 2016-05-10 21:59:42 -07:00
Toshio Kuratomi
99e3880181 small python3 fix so that ping will run on python3 2016-05-10 21:59:42 -07:00
Brian Coca
4561be00af simplified inventory error messaging 2016-05-10 17:16:26 -04:00
Tim Rupp
a685fa5543 Add port argument for bigsuds (#15434)
This patch adds the port argument as a valid parameter to the f5_spec.

This argument is supported in bigsuds version 1.0.4 and greater, so
this patch uses the __version__ variable of the bigsuds module to
determine when the port value should be honored by the module.
2016-05-10 16:07:01 -04:00
Brian Coca
f576082949 restore old jsonfile behaviour on key expiration
fixes #14456, now it won't expire keys in middle of a play when they
were 'valid' at 'gather time'.
2016-05-10 15:55:33 -04:00
Brian Coca
47d05e9b58 fix bad assignment, method modifies by ref already
fixes #15694
2016-05-10 12:08:03 -04:00
Matthew Stoltenberg
ddd9f92255 add repr for hostvars (#15793)
* allows passing full hostvars to a module
2016-05-10 10:23:10 -04:00
Toshio Kuratomi
9e88fa21f5 Update submodule refs 2016-05-10 07:13:57 -07:00
Kamjar Gerami
724e692f54 fixes-#15685-tools-that-paginate-show-spurious-less-output: less --version outputs to standard out not to standard error so this changes the redirect from 2> to > (#15720)
fixes-#15685-tools-that-paginate-show-spurious-less-output: Updated redirect to include stderr as well as stdout to not show any errors on screen
2016-05-09 16:48:46 -04:00
jctanner
781de83762 When walking through module directories, always follow symlinks. (#15784)
Fixes #15783
2016-05-09 14:24:39 -04:00
Toshio Kuratomi
409bfe4d0f Strip leading and trailing whitespace for json arg types 2016-05-09 08:14:50 -07:00
Robin Roth
30e5999812 Fix distribution_facts missing on BSD (#15780)
The previous fix in #15773 only solved MacOSX, but left other BSDs broken

fixes #15768
2016-05-09 10:55:28 -04:00
Pomin Wu
78808fc4cc Fixed ansible_os_family variable on OS X (#15768) (#15773)
Fixed `ansible_os_family` variable on OS X
2016-05-09 09:59:26 -04:00
nitzmahone
fca5ba153e bump extras submodule ref 2016-05-06 09:49:33 -07:00
Toshio Kuratomi
0a5831e654 Update submodule refs 2016-05-06 08:13:51 -07:00
Jiri Tyr
589f6d25bb Updating VCA module documentation (#14368) 2016-05-06 09:53:43 -04:00
James Cammarata
09c90f7f2f Fixing bugs in strategies
* Don't filter hosts remaining based on their failed state. Instead rely
  on the PlayIterator to return None/ITERATING_COMPLETE when the host is
  failed.
* In the free strategy, make sure we wait outside the host loop for all
  pending results to be processed.
* Use the internal _set_failed_state() instead of manually setting things
  when a failed child state is hit

Fixes #15623
2016-05-06 09:22:11 -04:00
Lars Kellogg-Stedman
21ac95402f do not erroneously set gathered_facts=True
In `lib/ansible/executor/play_iterator.py`, ansible sets a host's
`_gathered_facts` property to `True` without checking to see if there
are any tasks to be executed.  In the event that the entire play is
skipped, `_gathered_facts` will be `True` even though the `setup`
module was never run.

This patch modifies the logic to only set `_gathered_facts` to `True`
when there are tasks to execute.

Closes #15744.
2016-05-05 23:45:06 -04:00
nitzmahone
7708948d7d bump submodule refs 2016-05-05 17:05:36 -07:00
nitzmahone
133395db30 add jimi-c's unit test for squashed skip results, tweaked is_skipped() logic to pass 2016-05-05 15:29:10 -07:00
Andrew Taumoefolau
85868e07a9 Don't assume a task with non-dict loop results has been skipped.
This changeset addresses the issue reported here:

  ansible/ansible-modules-core#1765

The yum module (at least) includes its task results as strings, rather than
dicts, and the code this changeset replaces assumed that in that instance the
task was skipped. The updated behaviour assumes that the task has been
skipped only if:

* results exist, and
* all results are dicts that include a truthy skipped value
2016-05-05 15:29:10 -07:00
Brian Coca
3a6ca0b4a6 made ansible-doc complain on missing 'requried' 2016-05-05 17:02:39 -04:00
Brian Coca
fb7940fc50 check that variable first
before using string methods to check for magic interpreter var
2016-05-05 11:14:11 -04:00
camradal
be87cd8c26 Fix logging into vCloud Director and expose verify_certs argument (#15533) 2016-05-05 09:48:54 -04:00
Andrew Taumoefolau
bc81c76f86 Apply inventory host restrictions by host name rather than UUID.
Issue #15633 observes that a meta: inventory_refresh task causes the playbook
to exit. An inventory refresh flushes all caches and rebuilds all host
objects, assigning new UUIDs to each. These new host UUIDs currently fail to
match those on host objects stored for restrictions in the inventory, causing
the playbook to exit for having no hosts to run further tasks against.

This changeset attempts to address this issue by storing host restrictions
by name, and comparing inventory host names against these names when applying
restrictions in get_hosts.
2016-05-05 22:32:58 +10:00
Robin Roth
56ba10365c better fix for arch version detection (#15705)
* better fix for arch version detection

fixes  #15696

* be extra safe about tracebacks in facts.py

* add comments to explain the setup
* make allowempty more conservative, ignore file content
* wrap function call in try/except
  * should never happen, but if it happens the bug should be distribtion=N/A and not a traceback
2016-05-04 12:32:08 -07:00
nitzmahone
6373f2b045 error message cleanup 2016-05-04 09:43:41 -07:00
Toshio Kuratomi
ae9ddf0c1c Submodule updates to fix documentation 2016-05-03 10:12:02 -07:00
Tobias Wolf
87648f7bdf actionable.py: Do not print next task banner in handler callback (#15698)
Fix actionable callback plugin to not print the banner of the previous
task.

When a handler is executed there is no task banner, so in case it is run,
it will reference the banner from the preceding task.

**Author:** @hvhaugwitz

Test case:

      ---

      - name: actionable filter
        hosts: all
        handlers:
          - name: handler
            command: "true"
        tasks:
          - name: task 1
            file: path=/tmp/test state=touch
            notify: handler
          - name: task 2
            file: path=/tmp/test state=absent
          - name: task 3
            file: path=/tmp/test state=absent
          - name: task 4
            file: path=/tmp/test state=absent
          - name: task 5
            file: path=/tmp/test state=absent
          - name: task 6
            file: path=/tmp/test state=absent

Example output:

BEFORE
------

      PLAY [actionable filter] *******************************************************

      TASK [task 1] ******************************************************************
      changed: [localhost]

      TASK [task 2] ******************************************************************
      changed: [localhost]

      RUNNING HANDLER [handler] ******************************************************

      TASK [task 6] ******************************************************************
      changed: [localhost]

      PLAY RECAP *********************************************************************
      localhost                  : ok=8    changed=3    unreachable=0    failed=0

AFTER
-----

      PLAY [actionable filter] *******************************************************

      TASK [task 1] ******************************************************************
      changed: [localhost]

      TASK [task 2] ******************************************************************
      changed: [localhost]

      RUNNING HANDLER [handler] ******************************************************
      changed: [localhost]

      PLAY RECAP *********************************************************************
      localhost                  : ok=8    changed=3    unreachable=0    failed=0
2016-05-03 11:25:46 -04:00
James Pic
d72a03deae Add get_distribution_Archlinux (#15696) 2016-05-03 08:20:08 -07:00
Toshio Kuratomi
fff94551a1 Update core submodule ref to fix docs build 2016-05-03 07:53:27 -07:00
Toshio Kuratomi
3f104dcee9 Add a jsonarg type to arg spec (#15701)
This makes sure that if we get a list or dict that it is turned into
a jsonified string.
2016-05-03 10:21:00 -04:00
Brian Coca
e0573d3099 make vi the default editor if no EDITOR
fixes #15577
2016-05-03 09:39:19 -04:00