Commit Graph

59 Commits (9350b5ec22ce12605388976a74b23202d00133ba)

Author SHA1 Message Date
Matt Martz 7be8079bad Add configurable blacklist filtering for python logger 7 years ago
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
7 years ago
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.
7 years ago
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
7 years ago
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.
7 years ago
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
7 years ago
Brian Coca 498aea8acc Revert "Add log_only to debug messages (#25545)"
This reverts commit 9e8cc26720.
7 years ago
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.
7 years ago
Dag Wieers 51b595992b ansible/utils/: PEP8 compliancy (#24686)
- Make PEP8 compliant
7 years ago
Brian Coca a26c771bd9 fix cowsay for py3 8 years ago
Brian Coca 9ac9d42030 allow empty whitelist 8 years ago
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.
8 years ago
Toshio Kuratomi 70e63ddf6c Fix cow mode to work with unicode task and play names (#17576)
Fixes #17560
8 years ago
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.
8 years ago
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.
8 years ago
James Cammarata 37f721f315 Remove debug lock 8 years ago
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
8 years ago
Brian Coca 0eb2844cc6 moved display's debug lock to cli as global 9 years ago
Brian Coca 325fccfa78 added v for least verbose display function 9 years ago
Brian Coca 347aa7b032 Merge pull request #14774 from lamby/ignore-epipe-when-flushing-stdout-stderr
Ignore EPIPE when flushing stdout stderr
9 years ago
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>
9 years ago
Chris Lamb 951c8a5d27 Alias fileobj. 9 years ago
Brian Coca 0031a72e0d tweak deprecation warnings display 9 years ago
Brian Coca dc6f0c1290 avoid logging color codes 9 years ago
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
9 years ago
Brian Coca 66104191d1 fixed permissions check for ansible.log
fixes #13990
9 years ago
James Cammarata b1223746cd Relocate use of ERROR to display class, to avoid doubling up 9 years ago
Toshio Kuratomi 58f387a6dd Fix circular import 9 years ago
Toshio Kuratomi 8068f23bad do_encrypt import needed to move as well
Fixes #13861
9 years ago
Brian Coca c9a5f7ea7e updated self to cls to match convention
tempted to just use this. in all cases
9 years ago
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
9 years ago
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
9 years ago
Brian Coca d3deb24ead output color is now configurable 9 years ago
James Cammarata 86de1429e5 Cleaning up FIXMEs 9 years ago
Brian Coca 04aa7701d1 fix prompt, static methods don't get 'self'
fixes #12833
9 years ago
Brian Coca 71ffb86c30 don't let cowsay issues stop execution
fixes #12773
9 years ago
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.
9 years ago
Toshio Kuratomi b441bcb678 Fix display when run through a testing framework that overrides stderr/stdout 9 years ago
Toshio Kuratomi d1b98ec776 Correct typo 9 years ago
Toshio Kuratomi 2f5e817007 Do not mix byte str with unicode type 9 years ago
Toshio Kuratomi 01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
9 years ago
Brian Coca 4463ced8ba simpler safe output 9 years ago
soarpenguin 1ea66e234f fix logic judgment error. 9 years ago
soarpenguin 2caa52a981 fix no self pointer out of class. 9 years ago
Brian Coca 5f0359c119 keep banners at 79 9 years ago
Brian Coca 25e67bb716 text wrap now adapts to terminal 9 years ago
James Cammarata d44daf53cc Allow wrapped text in deprecated messages 9 years ago
Brian Coca 0b6fadaad7 started implementing diff
diff now works with template
also fixed check mode for template and copy
9 years ago
Brian Coca b19eb0f4dc minor improvements to display 9 years ago
Brian Coca cff77de917 added todo for future of feature 9 years ago