Commit Graph

61 Commits (6db074e7af0afe6ce485e933fcefeb6e7eed7b08)

Author SHA1 Message Date
Brian Coca c86fd6e2df Fix error reporting on bad type for config setting 2018-06-01 12:28:30 -04:00
jctanner bbfe7a8b2f
more debug logs for free, network_cli, paramiko and add hostname context to debugging messages (#39205)
* Add hostname context to debugging messages
* Set paramiko's channel
2018-04-26 17:10:28 -04:00
Matt Martz 7be8079bad Add configurable blacklist filtering for python logger 2018-02-05 22:12:16 -05:00
Ganesh Nalawade 90cd87f950
Fix debug logs failing with persistent connection (#33049)
* Fix debug logs failing with persistent connection

Fixes #33047

*  As debug logs are written on stdout, it interrupts
   the communication between ansible-connection(background)
   process and main process. To avoid this add a string similar
   to exactly identify the response string.

*  Remove unwanted code in ansible-connection

*  Fix review comments

* Fix spurious log emitted on ansible-connection stdout issue

*  ansible-connection which runs as a background process sends a
   json string (contains response received from remote device)
   to foreground ansible-playbook process over stdout.

*  If in case debug flag is enabled the connection_loader api
   invoked from ansible-connection `ssh = connection_loader.get('ssh', class_only=True)`
   results in emitting debug logs on stdout. This  spurious log
   interfere with the actual response and results in failure while
   reading json string in ansible-playbook process

* To avoid this save stdout of ansible-connection and redirect it string
  buffer to accumulate all the logs emitted by core API's

* Add these logs in `result['messages']` which is send a json string after reinstating saved stdout

*  Remove unwanted code in ansible-connection

* Fix review comment
2018-01-25 02:48:45 +05:30
Ryan Brown 95ff8f1a90 Change cow path selection variable from COWPATH to COW_PATH (#34063)
For consistency with other cow-related options, such as
`ANSIBLE_COW_SELECTION`, add an underscore to the new `ANSIBLE_COWPATH`
option.
2018-01-10 15:54:47 -05:00
Matt Bachmann f64b276f6a Add option allowing the user to specify a custom cowpath
This allows the user to use custom cowsay implementations without shadowing common cowsay paths
2017-12-19 15:39:38 -05:00
Andrea Tartaglia ea8af15dfe Updated Display.do_var_prompt to use to_native on prompt ( Fixes #30265 ) (#30285)
* Updated Display.prompt to use the normalized prompt message.
2017-09-13 09:58:28 -07:00
Brian Coca 075ead8fb0 fixes to config/setting retrieval
- better variable precedence management
- universal plugin option handling
- also updated comments for future directions
- leverage fragments for plugins
- removed fact namespacing
- added 'firendly name' field
- updated missing descriptions
- removed some unused yaml entries, updated others to reflect possible future
- documented more plugins
- allow reading docs using alias
- short licenses
- corrected args for 'all plugins'
- fixed -a option for ansible-doc
- updated vars plugins to allow docs
- fixed 'gathering'
- only set options IF connection
- added path list and renamed pathspec mostly the diff is , vs : as separator
- readded removed config entries that were deprecated but had no message ... and deprecated again
- now deprecated entries give warning when set
2017-09-09 09:48:22 -07:00
Brian Coca 498aea8acc Revert "Add log_only to debug messages (#25545)"
This reverts commit 9e8cc26720.
2017-06-13 09:29:18 -04:00
Ganesh Nalawade 9e8cc26720 Add log_only to debug messages (#25545)
Fixes #25544
When `debug` is enabled the debug messages triggered
from `bin/ansible-connection` should be logged only to file
and not on stdout.
2017-06-13 18:41:33 +05:30
Dag Wieers 51b595992b ansible/utils/: PEP8 compliancy (#24686)
- Make PEP8 compliant
2017-05-30 18:09:44 +01:00
Brian Coca a26c771bd9 fix cowsay for py3 2017-01-30 15:16:15 -05:00
Brian Coca 9ac9d42030 allow empty whitelist 2017-01-30 15:13:44 -05:00
Brian Coca d4ac0bdea9 display fixes
banner now adjusts to screen as does output
output now keeps at least one space to end of screen to allow for better reading.
2016-11-01 09:51:20 -04:00
Toshio Kuratomi 70e63ddf6c Fix cow mode to work with unicode task and play names (#17576)
Fixes #17560
2016-09-14 20:02:35 -07:00
Toshio Kuratomi bf29961947 Fixes to the controller text model (#17527)
* Fixes to the controller text model

* Change command line args to text type
* Make display replace undecodable bytes with replacement chars.  This
  is only a problem on pyhton3 where surrogates can enter into the msg
  but sys.stdout doesn't know how to handle them.
* Remove a deprecated playbook syntax in unicode.yml

* Fix up run_cmd to change its parameters to byte string at appropriate times.
2016-09-12 12:57:41 -07: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
James Cammarata 37f721f315 Remove debug lock 2016-09-06 13:04:50 -05:00
art-at-sky 38590fbab9 Fix string coercion problem in error handling code 10:50 (#16270)
Manifests as the following stack trace
  File "/usr/local/Cellar/ansible/2.0.1.0/libexec/lib/python2.7/site-packages/ansible/utils/display.py", line 259, in error
      new_msg = u"ERROR! " + msg
      TypeError: coercing to Unicode: need string or buffer, AnsibleParserError found
2016-06-17 12:02:01 -07:00
Brian Coca 0eb2844cc6 moved display's debug lock to cli as global 2016-04-08 13:08:24 -04:00
Brian Coca 325fccfa78 added v for least verbose display function 2016-03-07 13:17:31 -05:00
Brian Coca 347aa7b032 Merge pull request #14774 from lamby/ignore-epipe-when-flushing-stdout-stderr
Ignore EPIPE when flushing stdout stderr
2016-03-03 14:26:20 -05:00
Chris Lamb eb1141ee79 Ignore EPIPE to avoid tracebacks when piping output to other commands
For example:

  $ ansible web --list-hosts | head -n1
  hosts (7):
  ERROR! Unexpected Exception: [Errno 32] Broken pipe
  Traceback (most recent call last):
    File "/home/lamby/git/private/lamby-ansible2/.venv/bin/ansible", line 114, in <module>
      display.display("to see the full traceback, use -vvv")
    File "/home/lamby/git/private/lamby-ansible2/.venv/local/lib/python2.7/site-packages/ansible/utils/display.py", line 133, in display
      sys.stdout.flush()
  IOError: [Errno 32] Broken pipe

Such a pipe target will close up shop early when its seen enough input,
causing ansible to print an ugly traceback.

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
2016-03-03 19:21:06 +00:00
Chris Lamb 951c8a5d27 Alias fileobj. 2016-03-03 19:16:58 +00:00
Brian Coca 0031a72e0d tweak deprecation warnings display 2016-03-03 13:51:44 -05:00
Brian Coca dc6f0c1290 avoid logging color codes 2016-02-03 10:55:30 -05:00
Brian Coca c857b20043 fixed issue with vars prompt warning causing error
sometimes display object is not magically available, use it explicitly,
no need to be classmethod anymore
fixes #14147
2016-01-27 16:13:06 -05:00
Brian Coca 66104191d1 fixed permissions check for ansible.log
fixes #13990
2016-01-26 11:22:52 -05:00
James Cammarata b1223746cd Relocate use of ERROR to display class, to avoid doubling up 2016-01-19 12:10:39 -05:00
Toshio Kuratomi 58f387a6dd Fix circular import 2016-01-13 14:04:56 -08:00
Toshio Kuratomi 8068f23bad do_encrypt import needed to move as well
Fixes #13861
2016-01-13 13:08:33 -08:00
Brian Coca c9a5f7ea7e updated self to cls to match convention
tempted to just use this. in all cases
2016-01-08 17:57:09 -05:00
Brian Coca 1cc5ac06e7 restructure vars_prompt and fix regression
pushed it to use the existing propmpt from display and moved the vars prompt code there also for uniformity
changed vars_prompt to check extra vars vs the empty play.vars to restore 1.9 behaviour
sipmlified the code as it didn't need to check for syntax again (tqm is made none prior based on that)
fixes #13770
2016-01-08 11:46:04 -05:00
Brian Coca 737090dd13 now show full callback stacktrace when vvv+
Still is a warning as we don't want to repeat it multiple times nor additional callbacks to stop ansible execution.
hopefully we can avoid shipping w/o exceptions in the default/minimal callbacks...

Also added feature that now allows for 'preformated' strings passed to warning
2016-01-08 10:42:12 -05:00
Brian Coca d3deb24ead output color is now configurable 2015-12-29 17:40:47 -05:00
James Cammarata 86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Brian Coca 04aa7701d1 fix prompt, static methods don't get 'self'
fixes #12833
2015-10-21 12:06:29 -04:00
Brian Coca 71ffb86c30 don't let cowsay issues stop execution
fixes #12773
2015-10-16 15:20:59 -04:00
James Cammarata dce58a78c9 Make random cowsay truly random
Also adds a cowsay whitelist config option, because there are some
truly NSFW stencils that come with cowsay by default.
2015-10-15 10:52:53 -04:00
Toshio Kuratomi b441bcb678 Fix display when run through a testing framework that overrides stderr/stdout 2015-10-12 10:06:13 -07:00
Toshio Kuratomi d1b98ec776 Correct typo 2015-10-08 08:44:25 -07:00
Toshio Kuratomi 2f5e817007 Do not mix byte str with unicode type 2015-10-08 08:31:12 -07:00
Toshio Kuratomi 01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
2015-10-08 08:22:17 -07:00
Brian Coca 4463ced8ba simpler safe output 2015-10-08 10:15:48 -04:00
soarpenguin 1ea66e234f fix logic judgment error. 2015-09-26 15:15:53 +08:00
soarpenguin 2caa52a981 fix no self pointer out of class. 2015-09-26 14:09:56 +08:00
Brian Coca 5f0359c119 keep banners at 79 2015-08-06 17:37:05 -04:00
Brian Coca 25e67bb716 text wrap now adapts to terminal 2015-08-06 17:37:05 -04:00
James Cammarata d44daf53cc Allow wrapped text in deprecated messages 2015-08-06 17:21:02 -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