2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 11:30:23 +00:00

Merge branch '18csi'

This commit is contained in:
Jarrod Johnson 2018-10-09 09:46:44 -04:00
commit 67b93ee6b0
3 changed files with 19 additions and 4 deletions

View File

@ -48,6 +48,8 @@ argparser.add_option('-c', '--count', action='store_true',
argparser.add_option('-r', '--reverse', action='store_true',
help='Reverse sort order to show biggest output group '
'last')
argparser.add_option('-l', '--log', action='store', type='string', dest='log',
help='Log each output to file, using {node} as a placeholder for node.')
(options, args) = argparser.parse_args()
if sys.stdin.isatty():
argparser.print_help()
@ -64,7 +66,7 @@ def print_current():
if options.diff:
grouped.print_deviants(skipmodal=options.skipcommon, count=options.count,
reverse=options.reverse)
else:
else options.log:
grouped.print_all(skipmodal=options.skipcommon,
count=options.count,
reverse=options.reverse)
@ -80,6 +82,12 @@ while fullline:
continue
if ': ' not in line:
line = 'UNKNOWN: ' + line
if options.log:
node, output = line.split(': ', 1)
currlog = options.log.format(node=node, nodename=node)
with open(currlog, mode='a') as log:
log.write(output + '\n')
continue
grouped.add_line(*line.split(': ', 1))
if options.watch:
if not holdoff:

View File

@ -3,7 +3,7 @@ collate(1) -- Organize text input by node
## SYNOPSIS
`<other command> | collate [-a] [-d] [-w] [-s] [-c] [-r]`
`<other command> | collate [-a] [-d] [-w] [-s] [-c] [-r] [-l lognametemplate]`
## DESCRIPTION
@ -26,6 +26,10 @@ node and group names sorted alphanumerically.
Express all but the most common result group in terms of diff from
the most common result group
* `-l`, `--log`:
Save output per node to individual log files, replacing {node} in the name
with the nodename of each
* `-w`, `--watch`:
Update results dynamically as data becomes available, rather than
waiting for the command to fully complete.
@ -85,4 +89,4 @@ node and group names sorted alphanumerically.
` Processors.ExecuteDisableBit=Enable`

View File

@ -638,7 +638,10 @@ def clear_configuration():
stop_following()
_oldcfgstore = _cfgstore
_oldtxcount = _txcount
_cfgstore = {}
if _cfgstore is None or 'main' not in _cfgstore:
_cfgstore = {}
else:
_cfgstore['main'].clear()
_txcount = 0
def commit_clear():