implemented verbosity, added 5th level and now can see how many plays per playbooko if -vvvvv

pull/10478/merge
Brian Coca 10 years ago
parent 5531b84360
commit b1e6aaa790

@ -127,6 +127,7 @@ class PlaybookExecutor:
if entry:
entrylist.append(entry) # per playbook
self._display.vvvvv('%d plays in %s' % (i, playbook_path))
if entrylist:
return entrylist

@ -26,11 +26,9 @@ from ansible.utils.color import stringc
class Display:
def __init__(self, conn_info=None):
if conn_info:
self._verbosity = conn_info.verbosity
else:
self._verbosity = 0
def __init__(self, verbosity=0):
self.verbosity = verbosity
# list of all deprecation messages to prevent duplicate display
self._deprecations = {}
@ -70,10 +68,13 @@ class Display:
def vvvv(self, msg, host=None):
return self.verbose(msg, host=host, caplevel=3)
def vvvvv(self, msg, host=None):
return self.verbose(msg, host=host, caplevel=4)
def verbose(self, msg, host=None, caplevel=2):
# FIXME: this needs to be implemented
#msg = utils.sanitize_output(msg)
if self._verbosity > caplevel:
if self.verbosity > caplevel:
if host is None:
self.display(msg, color='blue')
else:
@ -124,4 +125,3 @@ class Display:
star_len = 3
stars = "*" * star_len
self.display("\n%s %s" % (msg, stars), color=color)

@ -72,6 +72,7 @@ class Cli(object):
parser.print_help()
sys.exit(1)
display.verbosity = options.verbosity
validate_conflicts(parser,options)
return (options, args)
@ -109,7 +110,7 @@ class Cli(object):
if options.listhosts:
for host in hosts:
self.display(' %s' % host.name)
self.display.display(' %s' % host.name)
sys.exit(0)
if ((options.module_name == 'command' or options.module_name == 'shell') and not options.module_args):
@ -163,7 +164,7 @@ class Cli(object):
if __name__ == '__main__':
display = Display()
#display.display(" ".join(sys.argv), log_only=True)
#display.display(" ".join(sys.argv))
try:
cli = Cli(display=display)

@ -53,6 +53,7 @@ def main(display, args):
parser.print_help(file=sys.stderr)
return 1
display.verbosity = options.verbosity
validate_conflicts(parser,options)
# Note: slightly wrong, this is written so that implicit localhost
@ -154,7 +155,7 @@ def main(display, args):
if __name__ == "__main__":
display = Display()
display.display(" ".join(sys.argv), log_only=True)
#display.display(" ".join(sys.argv), log_only=True)
try:
sys.exit(main(display, sys.argv[1:]))

Loading…
Cancel
Save