Commit Graph

242 Commits (ffa4f0c427e9a3ab2af442f71a7616e5fa5ccd60)

Author SHA1 Message Date
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
Brian Coca 275764d4a5 avoid showing invokation when no_log is set or verbosity is low 2015-10-23 14:06:20 -04:00
Toshio Kuratomi 99c6f77e59 Fix callback 2015-10-23 09:15:22 -07:00
Toshio Kuratomi ce2b18174e Merge pull request #12878 from ansible/invocation-fix
Invocation fix
2015-10-22 16:17:40 -07:00
Toshio Kuratomi 2e87c1f74e Two fixes to action plugins
* Fix the task_vars parameter to not default to a mutable type (dict)
* Implement invocation in the base class's run() method have each action
  module call the run() method's implemention in the base class.
* Return values from the action plugins' run() method takes the return
  value from the base class run() method into account so that invocation
  makes its way to the output.

Fixes #12869
2015-10-22 16:07:26 -07:00
Brian Coca 5017a96948 Revert "make callbacks declare needing whitelisting"
another premature merge
This reverts commit df8ff85787.
2015-10-22 16:34:51 -04:00
James Cammarata 86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Brian Coca df8ff85787 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 12:30:23 -04:00
Toshio Kuratomi 6b6d03290a Restore the automatic addition of invocation to the output
Revert "Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data."

This reverts commit 6ce6b20268.

Remove the note that invocation was removed as we've now restored it.

Revert "keyword not in ubuntu 14.04"

This reverts commit 5c01622457.

Revert "remove invocation keyword check"

This reverts commit 5177cb3f74.
2015-10-22 08:53:37 -07:00
Brian Coca c267c23020 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 08:27:32 -04:00
Toshio Kuratomi f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
James Cammarata e5b6d802bf Removing some cruft related to _local_action value on Task, which was removed
Fixes #12819
2015-10-19 16:52:27 -04:00
James Cammarata 1cfd941179 Adding a v2 callback for task includes 2015-10-19 13:42:17 -04:00
Toshio Kuratomi 6ce6b20268 Remove auto-added invocation return value as it is not used by v2 and could leak sensitive data. 2015-10-19 09:08:25 -07:00
Brian Coca 2d1d21228a updated skippy to match default output 2015-10-18 11:00:50 -04:00
Brian Coca 6c8cf8acb7 now profile_tasks callback handles handlers correctly
fixes #12762
2015-10-16 18:01:27 -04:00
Toshio Kuratomi baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Brian Coca 45788fbfad <homer>doh!</homer> 2015-10-09 16:58:01 -04:00
Brian Coca b9d54e9a01 corrects previous fix to deal with missing item key in results dict 2015-10-09 13:01:32 -04:00
Brian Coca fbf4cafab5 on skipped you 'might' not have an item, changed to getattr to avoid keyerror
fixes #12683
2015-10-09 11:28:11 -04:00
James Cammarata 770032648a Show -> localhost for local_action tasks 2015-10-09 10:53:53 -04:00
Brian Coca dac3684fd1 changed task color to dark gray to keep it from being confused with ignore/skip 2015-10-07 12:12:35 -04:00
Juraci e52950a939 Displaying task_path on task start when verbosity is more than 3 2015-10-07 10:11:50 -03:00
James Cammarata 9e364c2eb5 Don't modify results in callbacks
Fixes #12654
2015-10-06 21:43:43 -04:00
James Cammarata 38528c8ef3 Show more info in the minimal callback for unreachable hosts
Fixes #12621
2015-10-03 01:41:57 -04:00
Brian Coca e2ae3215f6 corrected no_log for items and skipped tasks
corrected output from default callback
added new tests for no_log loops
updated makefile test to check for both positive and negative occurrences of no_log
2015-10-02 14:35:33 -04:00
Brian Coca 4c9f58a152 added no_log censoring to item output
should be last commit that fixes #12214
2015-10-02 09:11:41 -04:00
Brian Coca 6b842d9c49 fixed incorrect data passing on certain events 2015-10-01 18:49:51 -04:00
Brian Coca 6e96188085 added missing entry for dealing with bcc 2015-10-01 18:49:51 -04:00
James Cammarata eb8d7dcd14 Make sure formatted strings don't bomb on tuples
Fixes #12501
2015-09-25 03:01:42 -04:00
Toshio Kuratomi 5d3d9cfe0d Convert to byte strings to avoid UnicodeErrors
Fixes #12488
2015-09-23 15:24:17 -07:00
James Cammarata c30e464388 Additional tweaks to callback output for delegate_to 2015-09-22 09:25:38 -04:00
James Cammarata 513619867a Show delegated-to host in callback message
Fixes #12465
2015-09-22 08:45:04 -04:00
Toshio Kuratomi 3db8070aa3 Fix urlopen usage to use open_url instead
Add a travis test for urlopen usage
2015-09-16 20:40:17 -07:00
Brian Coca 9d4d7bd74d fixed porting bugs in profile_tasks to v2 2015-09-11 16:48:09 -04:00
Brian Coca 6b73cac35a corrected skipped_hosts constant usage, thanks @benjixx 2015-08-30 20:21:15 -04:00
James Cammarata f0257683b0 Fixed missing constants import in default callback
Fixes #12145
2015-08-28 16:54:56 -04:00
Brian Coca b6c6ed91fe implemented not showing skipped hosts config 2015-08-28 12:32:50 -04:00
Brian Coca 861fdfc5ba updated callbacks to properly test diff no matter if dict or list 2015-08-16 02:37:21 -04:00
Brian Coca c3372936aa diff can now be a list 2015-08-16 02:37:21 -04:00
Brian Coca e46b1e8d2b adjusted tree to work more like v1, also now skips when dir not supplied 2015-08-12 10:35:49 -04:00
Brian Coca 4d853a5d3c implemented for v2, missing --tree option for adhoc 2015-08-11 19:18:10 -04:00
James Cammarata 169d316704 Fixing bugs in include + loops
Fixes #11872
2015-08-11 01:33:43 -04:00
Brian Coca 113f709eac brought up to date with default 2015-07-30 16:53:38 -04:00
Brian Coca a8b2b5b0c9 avoids printing blank diffs
fixes #10147 fixes #9471
2015-07-28 15:47:52 -04:00
Brian Coca f4a997db49 added back but stderr, which was the original itnention 2015-07-28 14:36:06 -04:00
Brian Coca 3b9282fb90 fixed dupe output in raw/command cases 2015-07-28 14:31:49 -04:00
Brian Coca 6cdee94c33 added missing skipped item function to base 2015-07-28 11:02:25 -04:00
Brian Coca 6f93d228f6 made item output closer to v1 2015-07-28 10:59:39 -04:00
Brian Coca 4f9d719b14 removed debug 2015-07-28 10:43:11 -04:00
Brian Coca d78c2fc212 now reports per task item 2015-07-28 10:41:40 -04:00
Brian Coca 787a0c4e04 fixed indent issues 2015-07-28 10:10:21 -04:00
Brian Coca 5f8db9cd4b changed verbose_override to the new _ansible_verbose_override to keep in line with previous changes
output now defaults back to having indent=4
2015-07-27 22:15:44 -04:00
James Cammarata cb262449c7 Reworking internal result flags and making sure include_vars hides vault data
Fixes #10194
2015-07-27 14:04:31 -04:00
Brian Coca a56ff7ae54 now it really is oneline 2015-07-26 23:14:07 -04:00
Brian Coca 5d1d9f1505 fixed diff output to be as it was in 1.x, copy and template now use the same
functions to do difs.
2015-07-26 22:29:56 -04:00
Brian Coca 0b6fadaad7 started implementing diff
diff now works with template
also fixed check mode for template and copy
2015-07-26 12:22:22 -04:00
Brian Coca a6ba149c49 implemented simplified output for adhoc adn command modules as in v1 2015-07-23 13:42:20 -04:00
James Cammarata e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
2015-07-21 12:13:50 -04:00
Pierre-Louis Bonicoli fda8fa77ab Fix pyflakes error: use 'msg' variable
Error was: local variable 'msg' is assigned to but never used
2015-07-20 12:41:39 +02:00
Brian Coca a09ce4bd87 added callback that skipts 'skipped' 2015-07-19 23:55:39 -04:00
Brian Coca 1aa4155266 generalized warning handling, added it to adhoc also 2015-07-17 14:14:15 -04:00
James Cammarata d4ac73a1bc Adding back capability to display warnings contained in results
Fixes #11255
2015-07-17 13:44:22 -04:00
Gerard Lynch a6c8d30f3e callbacks require a version constant or the v2 code doesn't pass the display param and it gives an error 2015-07-17 15:33:48 +01:00
Brian Coca a09f6236a5 adapated to v2 2015-07-17 08:55:22 -04:00
Brian Coca 10e5c2b46d fixed var scope 2015-07-17 08:54:28 -04:00
Tom Paine 097ed1f17b Add plugin that profiles playbook tasks
Resubmission of https://github.com/ansible/ansible/pull/11270 to
correct v2 file location.

[Description and console output
demonstration](https://github.com/aioue/ansible-plugin-profile/blob/mast
er/README.md#features).

Provides per-task timing, ongoing playbook elapsed time and ordered
list of top 20 longest running tasks at end.
2015-07-17 13:04:31 +01:00
Brian Coca b76cb8f655 now that invocation is only async again, no need to sanitize 2015-07-15 10:40:37 -04:00
James Cammarata 6971e92f39 Fixing up some output stuff 2015-07-14 00:23:17 -04:00
Brian Coca c4b6d91275 added skipped to oneline 2015-07-13 15:54:12 -04:00
Brian Coca 8ad52c2e4f readded oneline output feature to adhoc
fixes #11573
2015-07-13 15:43:31 -04:00
Brian Coca 3a768b3b9f removed unused methods, these now live in base class 2015-07-13 15:43:31 -04:00
Brian Coca ba92965670 fix for when invocation data is missing 2015-07-12 16:10:52 -04:00
Brian Coca 4203b699a8 removed dict comprehension as 2.6 does not like 2015-07-11 15:15:46 -04:00
Brian Coca d993e7000c added cyan back to ignoring message 2015-07-11 15:01:50 -04:00
Brian Coca 1274ce565d added result sanitation to registered var and to callbacks
removed time display as it only is provided by command module
2015-07-11 01:05:29 -04:00
Brian Coca fdea00880b now default shows time taken when -vv or above 2015-07-11 00:02:40 -04:00
Brian Coca 7a1bce1b5d added verbose option to show callback loaded info
also made mail module print nicer without all those 'u'
2015-07-10 23:48:12 -04:00
teh 4r9h 705018a417 Misspell in mail.py callback.
Looks like little misspell.
2015-07-11 02:53:32 +02:00
Brian Coca aaad33ccb6 fixed a couple of bugs 2015-07-10 10:30:33 -04:00
Brian Coca d0c6d2ff1c poreted log_plays, syslog_json and osx_say callbacks to v2
renamed plugins to contrib (they are not really plugins)
rewrote README.md to reflect new usage
added new dir to setup.py so it gets copied with installation, in views
of making using inventory scripts easier in teh future
2015-07-10 10:30:33 -04:00
Brian Coca 50d54b1be7 ported hipchat callback to v2 (needs testing) 2015-07-10 10:30:33 -04:00
Brian Coca e92e15b5f6 moved unused functions to base object 2015-07-10 10:30:33 -04:00
Brian Coca b47d7babe5 removed warning i was using for debug 2015-07-10 10:30:33 -04:00
Brian Coca 834b7a2857 ported context_demo to v2 callbacks 2015-07-10 10:30:33 -04:00
Brian Coca ba0e5323d6 removed connection info to _verbosity, just needed callbacks to call correct display.verbosity
added v2 methods and made them call v1 when possible by tranforming the data
2015-07-10 10:30:33 -04:00
Brian Coca f9d817e636 now looks at correct verbosity and removes the need to set a copy of it in _verbosity 2015-07-10 10:30:33 -04:00
Brian Coca 55366bdc6d ported mail callback plugin to work with v2 2015-07-08 16:33:51 -04:00
Brian Coca d149ea5222 ported timer.py callback to v2 2015-06-29 20:45:50 -04:00
James Cammarata 006391eb83 Add the improved exception reporting to the minimal callback plugin 2015-06-23 12:14:14 -04:00
James Cammarata 0d92599d18 Make exception printing a bit smarter 2015-06-19 22:59:12 -04:00
James Cammarata f3f3fb7c49 Fixing vars_prompt 2015-06-04 13:54:51 -04:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00