Commit Graph

50 Commits (b49d39c5dbdbf3faf959c3bdee10c245b502e1e3)

Author SHA1 Message Date
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
Brian Coca b19eb0f4dc minor improvements to display 2015-07-25 09:15:33 -04:00
Brian Coca cff77de917 added todo for future of feature 2015-07-24 12:00:38 -04:00
Brian Coca 0089eb8102 reimplemented logging based on log_path var 2015-07-24 12:00:38 -04:00
James Cammarata e526743b4f Allowing `args: "{{some_var}}"` for task params again
This is unsafe and we debated re-adding it to the v2/2.0 codebase,
however it is a common-enough feature that we will simply mark it
as deprecated for now and remove it at some point in the future.

Fixes #11718
2015-07-24 10:33:12 -04:00
Brian Coca 88e1ef8c9b implemented --step in v2 2015-07-23 20:47:40 -04:00
Brian Coca 851ed45bbf adding display to plugins and start moving debug to display 2015-07-23 10:26:12 -04:00
Brian Coca 5a5b7ff561 fixed first_available_found for template, refactored into common function
added deprecation warning
fixed display.deprecated to make version optional (code already assumed this)
turned warning + 'deprecated' in plugin loader into actual call to deprecated()
2015-07-15 19:47:59 -04:00
Toshio Kuratomi 49a148056c Ensure that we're dealing with byte str when we print or log messages 2015-07-07 12:05:59 -07:00
Marc Abramowitz 314bae2a9e Don't wrap text for AnsibleParserError
This allows not messing up the wonderful error reporting that is
carefully created. Instead of:

    $ ansible-playbook foo.yml
     [ERROR]: ERROR! 'foo' is not a valid attribute for a Task  The error appears
    to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7,
    but may be elsewhere in the file depending on the exact syntax problem.  The
    offending line appears to be:    tasks:     - name: do something       ^ here

we get:

    $ ansible-playbook foo.yml
    ERROR! 'foo' is not a valid attribute for a Task

    The error appears to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

      tasks:
        - name: do something
          ^ here

which is much nicer.
2015-07-07 09:31:00 -07:00
Brian Coca e7a096c4c5 cowsay is back! 2015-05-28 20:01:39 -04:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00