Commit Graph

242 Commits (ffa4f0c427e9a3ab2af442f71a7616e5fa5ccd60)

Author SHA1 Message Date
Brian Coca 7450629733 better display for free strategy (#17355) 2016-09-13 12:59:32 -04:00
Brian Coca cd2f60e11a take delegated vars before removing them
fixes #17455
2016-09-09 09:55:24 -04:00
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
2016-09-06 22:54:17 -07:00
Brian Coca ff34f5548d Dynamic role include (#17401)
* dynamic role_include

* more fixes for dynamic include roles

* set play yfrom iterator when dynamic

* changes from jimi-c

* avoid modules that break ad hoc

TODO: should really be a config
2016-09-05 20:07:58 -04:00
Andrew Gaffney f65a3ce547 Support for specifying item label in a loop (#17294) 2016-08-31 09:59:43 -04:00
Chris Faulkner dbab23e68f Fix context_demo callback plugin. (#17235) 2016-08-25 10:22:27 -07:00
Toshio Kuratomi a22909c226 Migrate basestring to a python3 compatible type (#17199) 2016-08-23 13:13:44 -07:00
Adrian Likins 71118b2720 Show where plugins were loaded in vvv/vvvv (#15757)
Make the plugin loading info displayed by callback plugins
match.

In debug mode (ANSIBLE_DEBUG=1 env), log all requests for
plugins including already cached plugins and class_only
requests.
2016-08-23 11:54:14 -04:00
Adrian Likins f21df311bc Fix hipchat callback "has no attribute display'" (#16998)
Use self._display for access to display object for
the hipchat callback plugin.

Fixes #16946
2016-08-08 11:04:06 -04:00
Matt Clay e07fbba0a5 Add missing boilerplate code. (#16980) 2016-08-05 12:22:52 -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
Matt Martz 4065acc37d indent callback output if using 3verbosity or higher (#16231) 2016-07-23 18:10:53 -04:00
Brian Coca 729686a434 added back spaces for profile_tasks formatting 2016-07-06 15:39:09 -04:00
NAGA RAVI CHAITANYA ELLURI b312a43544 fix(callback-mail plugin): fixes the warning 'TaskResult' object has no attribute '__getitem__' because of which its not sending an email on failure (#16547) 2016-07-01 13:25:48 -04:00
Brian Coca faec03aabc fix encoding issues in profile_tasks (#16522)
* fix encoding issues in profile_tasks

fixes #16521

* really fix it

* unicode the nested

* simpler format

* readded space after name
2016-07-01 10:21:49 -04:00
Matt Clay 8f1b487141 Handle repeat includes in junit callback. (#16484) 2016-06-28 15:55:46 -07:00
Matt Clay c2a5cb6174 Fix junit callback plugin for Python 2.6. (#16440) 2016-06-24 14:22:27 -07:00
Krzysztof Magosa 721da46842 fix: playbook_on_task_start expects name and not task object (#16168) 2016-06-07 09:43:01 -04:00
Matt Clay 7edfeb3665 Add junit callback plugin. (#16089)
Add junit callback.
2016-06-01 13:34:00 -07:00
Matt Clay 126bc40ecf Do not remove exception from result, hide output.
This allows all callback plugins access to exception details.
2016-05-31 11:28:22 -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
Toshio Kuratomi f39ad1f13a Get rid of logentries.to_unicode.
It wasn't doing anything that a literal couldn't do and used
unicode_escape which only understands latin1 (The author of the code
seems to have thought it took an encoding argument but it looks like
that was silently ignored.)
2016-04-30 07:45:51 -07:00
Brian Coca 6f4f8e6e79 fix typo 2016-04-29 15:01:25 -04:00
Brian Coca d53c4b8ae7 fixed method signature as per #15668 2016-04-29 13:13:01 -04:00
Dag Wieers d46af7cda3 On change in diff-mode we don't need to see file content in task output
I was surprised to see complete file content in the (JSON) task output when
in diff-mode. Since we see the diff anyhow, there's no need to send everything
on screen.
2016-04-01 18:03:51 +02:00
Brian Coca 5b11494437 python3 compatiblity
remove use of basestring
deal with configparser
2016-03-24 06:39:21 -07:00
Tobias Wolf 4938b98e4e For `actionable` cb plugin also hide ok for itemized results
The purpose of the `actionable` callback plugin is to hide uninteresting
results.

Also hide the ok results when the task was itemized.
2016-03-21 14:59:57 +01:00
James Cammarata 13f3cbaf3b Renaming per-item and retry callbacks 2016-03-18 15:17:43 -04:00
James Cammarata 1ee6d489ab Make sure tuples returned by _get_item() are handled correctly in formatting
Fixes #14800
2016-03-17 14:19:58 -04:00
Brian Coca bc60f52db5 avoid exceptiosn when not being called by CLI 2016-03-17 07:19:35 -07:00
Dag Wieers ed457ad53b Fix the color when unreachable in default cb plugin
The dedicated color for unreachable errors was not being used in the default cb plugin.
This corrects the color.
2016-03-17 00:18:13 +01:00
Brian Coca 2984ffdfac now item callback honors display_skipped_hosts
fixes #14956
2016-03-14 13:13:50 -04:00
James Cammarata aee2eb6287 Merge pull request #14864 from dagwieers/patch-12
Only show diff when the task actually induced a change
2016-03-08 15:02:49 -05:00
Dag Wieers f5b6f52940 Only show diff when the task actually induced a change
This implements solution #1 in the proposal #14860.

It only shows the diff if the task induced a change, which means that if the changed_when control overrides the task, not diff will be produced.
See #14860 for a rationale and the use-case.
2016-03-08 17:33:29 +01:00
Dag Wieers 175351f200 Little improvement in flow
Don't get the hostname if it's not needed.
2016-03-08 17:23:34 +01:00
Brian Coca 6cad356b3b updated docs to show new output 2016-03-03 18:05:39 -05:00
Brian Coca b2a6784a9f changed the output to keep backwards compat
still shows path when verbose
2016-03-03 18:03:02 -05:00
Joel b3aa373932 Update the profile task callback plugin to include a fix for duplicate named tasks. Added additional features to adjust the number of tasks output and the sort order. 2016-02-25 10:02:36 -06:00
James Cammarata e02b98274b issue callbacks per item and retry fails
- now workers passes queue to task_executor so it can send back events per item and on retry attempt
- updated result class to pass along events to strategy
- base strategy updated to forward new events to callback
- callbacks now remove 'items' on final result but process them directly when invoked per item
- new callback method to deal with retry attempt messages (also now obeys nolog)
- updated tests to match new signature of task_executor

fixes #14558
fixes #14072
2016-02-23 15:07:06 -05:00
Brian Coca e35b1cf154 show task path on vv and above 2016-02-21 16:22:39 -05:00
Brian Coca cea10794fd removed unused color var 2016-02-21 02:03:48 -05:00
Brian Coca 6febb816d2 Merge pull request #14569 from sivel/json-stdout-callback
Add json stdout callback
2016-02-19 07:12:30 -08:00
George Christou bbc855c218 Make --diff lines of context configurable 2016-02-19 12:18:09 +00:00
Matt Martz 7f7536f7ad Add json callback to be used in replace of the default stdout to print a JSON structure to stdout 2016-02-18 16:39:31 -06:00
Matt Davis 4c58066153 Merge pull request #14557 from ansible/display-play-args
Add a configuration setting that allows the user to specify printing …
2016-02-18 07:40:50 -08:00
Toshio Kuratomi 86b8dc0e79 Add a configuration setting that allows the user to specify printing of task arguments in the header.
Fixes #14554
2016-02-18 04:20:35 -08:00
Brian Coca 1dba6da40f changed filtered to actionable cb plugin 2016-02-18 02:32:05 -08:00
Brian Coca 54942ee8ff Merge pull request #13593 from agaffney/devel
Add 'filtered' stdout callback plugin
2016-02-18 02:30:32 -08:00
Brian Coca 22082216a4 Merge pull request #13408 from sivel/v2-slack-callback
V2 slack callback plugin
2016-02-18 02:12:39 -08:00
Brian Coca 6012646d8c added playbook and options info to callbacks
will display on certain verbosity levels, both playbook/file info
and non empty options with which it's running.
avoid errors when not using CLI classes
2016-02-18 02:09:07 -08:00
George Christou 56239ee347 Make --diff colours configurable 2016-02-17 10:25:54 +00:00
George Christou 8edcca0ef5 Add simple --diff colour support 2016-02-15 22:23:03 +00:00
Sandra Wills edf776d6a4 Merge pull request #13805 from aioue/patch-1
profile_tasks README.md
2016-02-12 12:23:45 -05:00
Tom Paine edb36b6c4a Update profile_tasks.rst
remove brackets on links
2016-02-12 17:13:39 +00:00
Tom Paine 8e3cc3eecd Update profile_tasks.rst 2016-02-08 19:19:05 +00:00
Tom Paine 5a88cd8ad9 Rename profile_tasks.md to profile_tasks.rst 2016-02-08 15:02:50 +00:00
Tom Paine 9eca815377 Update profile_tasks.md
Converted to RST.
2016-02-05 18:06:10 +00:00
Tobias Wolf c902f926ca Do not print empty diffs with _display.display() 2016-02-03 16:20:16 +01:00
Tobias Wolf 28169492f9 Do not insert newlines when diff is empty 2016-02-03 16:20:16 +01:00
Tobias Wolf 67594e8ec2 Fix handling of difflist containing multiple before/after pairs
Commit ansible/ansible@c337293 introduced a difflist feature. The return
value was not adequately outdented to append any diff after the first.
2016-02-03 16:20:16 +01:00
Toshio Kuratomi 9e3932ffca Some attributes of callbacks aren't in v2. Port plugins to the v2 way to do that
Update porting guide with info on callback porting
2016-01-29 19:45:12 -08:00
Matt Martz 4547ac7fb1 v2 version of slack callback plugin 2016-01-28 16:13:29 -06:00
Tobias Wolf 5b293b56d6 Handle the key 'prepared' in the 'diff' result from modules
So far, when a 'diff' dict is returned with module results, it is
checked for 'before' and 'after' texts, which are processed in
_get_diff() by python difflib.  This generates the changes to display
when CLI users specify --diff.

However, some modules will generate changes that cannot easily be
expressed in a conventional diff. One example is the output of the
synchronize module, which presents changed files in a common log format
as in `rsync --itemize-changes`.

Add a check for a diff['prepared'] key, which can contain prepared diff text
from modules.
2016-01-26 09:29:37 +01:00
Tom Paine 76ac6294e0 profile_tasks README.md
As agreed with Brian Coca in Ansible Project group:
https://groups.google.com/forum/#!searchin/ansible-project/tom$20paine/ansible-project/__nv6BZs2yU/AkYQ0HU-BQAJ
2016-01-11 18:21:28 +00:00
James Cammarata dc47c25e58 Minor tweak to ensure diff is not empty in callback for file diffs 2016-01-05 22:01:01 -05:00
Brian Coca 095790ac5c Merge pull request #13691 from bcoca/colors
output color is now configurable
2016-01-05 14:33:01 -05:00
Brian Coca f3c45adfb8 simplified diff handling in callback
no need for the copy or other complexity
2016-01-05 14:26:38 -05:00
Brian Coca 9972c27a9b now handles 'non file diffs'
this allows modules to pass back a 'diff' dict and it will still show using the file interface
2016-01-05 14:26:38 -05:00
Brian Coca d3deb24ead output color is now configurable 2015-12-29 17:40:47 -05:00
James Cammarata 2d11cfab92 Squashed commit of the following:
commit 24efa310b58c431b4d888a6315d1285da918f670
Author: James Cammarata <jimi@sngx.net>
Date:   Tue Dec 29 11:23:52 2015 -0500

    Adding an additional test for copy exclusion

    Adds a negative test for the situation when an exclusion doesn't
    exist in the target to be copied.

commit 643ba054877cf042177d65e6e2958178bdd2fe88
Merge: e6ee59f 66a8f7e
Author: James Cammarata <jimi@sngx.net>
Date:   Tue Dec 29 10:59:18 2015 -0500

    Merge branch 'speedup' of https://github.com/chrismeyersfsu/ansible into chrismeyersfsu-speedup

commit 66a8f7e873ca90f7848e47b04d9b62aed23a45df
Author: Chris Meyers <chris.meyers.fsu@gmail.com>
Date:   Mon Dec 28 09:47:00 2015 -0500

    better api and tests added

    * _copy_results = deepcopy for better performance
    * _copy_results_exclude to deepcopy but exclude certain fields. Pop
    fields that do not need to be deep copied. Re-assign popped fields
    after deep copy so we don't modify the original, to be copied, object.
    * _copy_results_exclude unit tests

commit 93490960ff4e75f38a7cc6f6d49f10f949f1a7da
Author: Chris Meyers <chris.meyers.fsu@gmail.com>
Date:   Fri Dec 25 23:17:26 2015 -0600

    remove uneeded deepcopy fields
2015-12-29 11:40:18 -05:00
Andrew Gaffney 0f4d1eb051 Add 'filtered' stdout callback plugin
This plugin filters output for any task that is 'ok' or 'skipped'.
It works by subclassing the 'default' stdout callback plugin and
overriding certain functions. It will suppress display of the task
banner until there is a 'changed' or 'failed' result or an
unreachable host.
2015-12-21 22:41:52 +00:00
Brian Coca be5488cb60 clean debug output to match prev versions 2015-12-15 09:27:53 -05:00
Brian Coca f3bedbae29 simplified skippy
thanks agaffney!
2015-12-12 17:50:55 -05:00
James Cammarata 14e19c239d Make on_file_diff callback item-aware 2015-12-09 14:52:53 -05:00
Brian Coca 0719eb3e2d clarified warning from tree callback 2015-12-09 07:29:12 -08:00
Brian Coca 795fac917e fixed typo in tree callback, added default dir
this would allow it to work with playbooks also
2015-12-08 11:59:04 -08:00
Matt Martz 384b2e0234 Get v2_playbook_on_start working
* Move self._tqm.load_callbacks() earlier to ensure that v2_on_playbook_start can fire
* Pass the playbook instance to v2_on_playbook_start
* Add a _file_name instance attribute to the playbook
2015-12-02 11:29:51 -06:00
Brian Coca 3e01516783 fixed signature for init on callbacks
also removed passing display to base class which already handles this
2015-12-01 14:06:54 -08:00
James Cammarata 6671d78f95 Tweak location of stats callback execution and properly relocate stats output code 2015-11-28 14:03:21 -05:00
Brian Coca 7244b5ae49 added missing : 2015-11-25 10:52:42 -08:00
Brian Coca 0ec60ac09b added missing events to base class 2015-11-25 10:49:03 -08:00
Brian Coca 83f7942dcf removed print entries, corrected display calls to match latest devel 2015-11-16 11:35:10 -08:00
Brian Coca 78be81b96d Merge pull request #12510 from jcftang/devel
Initial add of logentries callback plugin
2015-11-15 11:28:02 -08:00
Brian Coca f1db99caa7 updated with latest changes to default 2015-11-15 10:09:24 -08:00
Jimmy Tang 19ba54c9fd Don't be fatal on import errors so plays don't fail if plugin doesn't have required dependencies 2015-11-14 20:02:03 +00:00
Jimmy Tang 125370ab48 Run when whitelisted 2015-11-14 19:46:00 +00:00
Jimmy Tang 5f2f5e2b59 Add boilerplate and fix initialisation to match what 2.0 expects 2015-11-14 08:54:41 +00:00
Jimmy Tang c02ceb8f12 Remove threading and queues. Added license information and cleaned up callback. 2015-11-14 08:40:16 +00:00
Jimmy Tang 85277c8aae Initial add of logentries callback plugin
This callback plugin will generate json objects to be sent to the
logentries service for auditing/debugging purposes.

To use:

Add this to your ansible.cfg file in the defaults block

    [defaults]
    callback_plugins = ./callback_plugins
    callback_stdout = logentries
    callback_whitelist = logentries

Copy the callback plugin into the callback_plugings directory

Either set the environment variables

    export LOGENTRIES_API=data.logentries.com
    export LOGENTRIES_PORT=10000
    export LOGENTRIES_ANSIBLE_TOKEN=dd21fc88-f00a-43ff-b977-e3a4233c53af

Or create a logentries.ini config file that sites next to the plugin with the following contents

    [logentries]
    api = data.logentries.com
    port = 10000
    tls_port = 20000
    use_tls = no
    token = dd21fc88-f00a-43ff-b977-e3a4233c53af
2015-11-14 08:40:16 +00:00
Toshio Kuratomi 62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
James Cammarata a99f2fd52f Save delegated vars in result for use in callback methods
Fixes #13014
2015-11-10 10:14:30 -05:00
Brian Coca e2c56efca6 Merge pull request #12867 from bcoca/callback_whitelist_tweak
make callbacks declare needing whitelisting
2015-11-05 12:58:05 -05:00
Toshio Kuratomi 658ea053ea Cleanup timer callback plugin's overwriting of modules it imported 2015-11-03 09:53:18 -08:00
Brian Coca 467c29e3db show task path on 2 vs 2015-11-01 17:43:11 -05:00
Brian Coca 7ba4f5ee12 removed no_log redundant code 2015-10-30 14:01:47 -04:00
Brian Coca b97887ba41 simplified invocation removal, added no_log awareness 2015-10-30 10:17:19 -04:00
Brian Coca 8ce864db6f sanatize results 2015-10-24 15:23:12 -04:00
Toshio Kuratomi 92dd563a75 Fix invocation from bad merge and note where it would need to go to keep
it out of registered vars as well.
2015-10-24 07:29:42 -07:00
Brian Coca 25e3fe04a8 finalized changed to use abridtged_result instead of result
removed no longer defined no_log
2015-10-23 23:10:57 -04:00
Toshio Kuratomi 3812ec8d1d Implement invocation hiding for all callbacks if the verbosity is low 2015-10-23 11:11:34 -07:00