diff options
| author | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-03 23:14:33 -0400 |
|---|---|---|
| committer | Seth Vidal <skvidal@fedoraproject.org> | 2013-07-03 23:14:33 -0400 |
| commit | 0ef3ff79ad7b3b938e10c31da77451a073a0f9b2 (patch) | |
| tree | 586a7b035f2f49744f7544676dc709fc8258ff91 /scripts | |
| parent | 97a906435ad6d33fe6d2c169587f34082a245214 (diff) | |
tab/space issues
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/show_changed | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/scripts/show_changed b/scripts/show_changed index 52c2d08e1..5cfaa396a 100755 --- a/scripts/show_changed +++ b/scripts/show_changed @@ -29,33 +29,32 @@ def parse_args(args): opts.datestr = date_cheat(opts.datestr) if not opts.search_terms: - opts.search_terms = search_terms + opts.search_terms = search_terms return opts, args def search_logs(opts, logfiles): - msg = '' - for fn in logfiles: - hostname=os.path.basename(fn).replace('.log', '') - timestamp = os.path.basename(os.path.dirname(fn)) - for line in open(fn): - things = line.split('\t') - if things[2] in opts.search_terms: - slurp = json.loads(things[4]) - msg += '%s\t%s\t%s\t%s\t%s\t%s' % (timestamp, hostname, things[0], things[1], things[2], things[3]) - if not opts.verbose: - if type(slurp) == dict: - for term in ['task_userid', 'cmd']: - if term in slurp: - msg += '\t%s:%s' % (term, slurp.get(term, None)) - msg += '\n' - else: - msg += '\n' - msg += json.dumps(slurp, indent=4) - msg += '\n' - - return msg - - + msg = '' + for fn in logfiles: + hostname=os.path.basename(fn).replace('.log', '') + timestamp = os.path.basename(os.path.dirname(fn)) + for line in open(fn): + things = line.split('\t') + if things[2] in opts.search_terms: + slurp = json.loads(things[4]) + msg += '%s\t%s\t%s\t%s\t%s\t%s' % (timestamp, hostname, things[0], things[1], things[2], things[3]) + if not opts.verbose: + if type(slurp) == dict: + for term in ['task_userid', 'cmd']: + if term in slurp: + msg += '\t%s:%s' % (term, slurp.get(term, None)) + msg += '\n' + else: + msg += '\n' + msg += json.dumps(slurp, indent=4) + msg += '\n' + + return msg + def main(args): opts,args = parse_args(args) @@ -72,4 +71,4 @@ def main(args): if __name__ == "__main__": sys.exit(main(sys.argv[1:])) -
\ No newline at end of file + |
