Merge lp:~nuclearbob/utah/log-changes into lp:utah

Proposed by Max Brustkern
Status: Merged
Approved by: Joe Talbott
Approved revision: 755
Merged at revision: 754
Proposed branch: lp:~nuclearbob/utah/log-changes
Merge into: lp:utah
Diff against target: 113 lines (+19/-4)
8 files modified
examples/run_install_test.py (+2/-0)
examples/run_test_bamboo_feeder.py (+2/-0)
examples/run_test_cobbler.py (+2/-0)
examples/run_test_vm.py (+2/-0)
examples/run_utah_tests.py (+2/-0)
examples/utah_logs.sh (+2/-0)
utah/provisioning/provisioning.py (+4/-4)
utah/run.py (+3/-0)
To merge this branch: bzr merge lp:~nuclearbob/utah/log-changes
Reviewer Review Type Date Requested Status
Joe Talbott (community) Approve
Review via email: mp+134750@code.launchpad.net

Description of the change

This branch adds three changes.

A dumplogs option is added to the provisioning scripts. This will print all client logs to standard out after retrieval.

The default log collector script used by the jenkins jobs is updated to place yaml files in a clientlogs directory.

The format for console logging is set to the same as the file logging format, complete with timestamps.

To post a comment you must log in.
Revision history for this message
Joe Talbott (joetalbott) wrote :

Looks good. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'examples/run_install_test.py'
--- examples/run_install_test.py 2012-11-16 15:39:51 +0000
+++ examples/run_install_test.py 2012-11-16 21:27:24 +0000
@@ -77,6 +77,8 @@
77 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',77 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',
78 'none'), help='Enable or disable automatic '78 'none'), help='Enable or disable automatic '
79 'configuration rewriting')79 'configuration rewriting')
80 parser.add_argument('--dumplogs', action='store_true',
81 help='Write client output logs to standard out')
80 return parser82 return parser
8183
8284
8385
=== modified file 'examples/run_test_bamboo_feeder.py'
--- examples/run_test_bamboo_feeder.py 2012-11-14 16:14:38 +0000
+++ examples/run_test_bamboo_feeder.py 2012-11-16 21:27:24 +0000
@@ -48,6 +48,8 @@
48 help='Enable debug logging')48 help='Enable debug logging')
49 parser.add_argument('-j', '--json', action='store_true',49 parser.add_argument('-j', '--json', action='store_true',
50 help='Enable json logging (default is YAML)')50 help='Enable json logging (default is YAML)')
51 parser.add_argument('--dumplogs', action='store_true',
52 help='Write client output logs to standard out')
51 return parser53 return parser
5254
5355
5456
=== modified file 'examples/run_test_cobbler.py'
--- examples/run_test_cobbler.py 2012-11-16 15:39:51 +0000
+++ examples/run_test_cobbler.py 2012-11-16 21:27:24 +0000
@@ -54,6 +54,8 @@
54 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',54 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',
55 'none'), help='Enable or disable automatic '55 'none'), help='Enable or disable automatic '
56 'configuration rewriting')56 'configuration rewriting')
57 parser.add_argument('--dumplogs', action='store_true',
58 help='Write client output logs to standard out')
57 return parser59 return parser
5860
5961
6062
=== modified file 'examples/run_test_vm.py'
--- examples/run_test_vm.py 2012-11-16 15:39:51 +0000
+++ examples/run_test_vm.py 2012-11-16 21:27:24 +0000
@@ -45,6 +45,8 @@
45 parser.add_argument('-o', '--outdir', 45 parser.add_argument('-o', '--outdir',
46 help=('Directory to store locally copied files '46 help=('Directory to store locally copied files '
47 '(Default is ' + config.logpath + '/machine-name)'))47 '(Default is ' + config.logpath + '/machine-name)'))
48 parser.add_argument('--dumplogs', action='store_true',
49 help='Write client output logs to standard out')
48 return parser50 return parser
4951
5052
5153
=== modified file 'examples/run_utah_tests.py'
--- examples/run_utah_tests.py 2012-11-16 15:39:51 +0000
+++ examples/run_utah_tests.py 2012-11-16 21:27:24 +0000
@@ -81,6 +81,8 @@
81 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',81 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',
82 'none'), help='Enable or disable automatic '82 'none'), help='Enable or disable automatic '
83 'configuration rewriting')83 'configuration rewriting')
84 parser.add_argument('--dumplogs', action='store_true',
85 help='Write client output logs to standard out')
84 return parser86 return parser
8587
8688
8789
=== modified file 'examples/utah_logs.sh'
--- examples/utah_logs.sh 2012-07-31 14:26:27 +0000
+++ examples/utah_logs.sh 2012-11-16 21:27:24 +0000
@@ -4,5 +4,7 @@
4NAME=$(grep -m1 -o "utah-[0-9]*" log)4NAME=$(grep -m1 -o "utah-[0-9]*" log)
5grep "$NAME" /var/log/utah/$(hostname).log* > fulllog5grep "$NAME" /var/log/utah/$(hostname).log* > fulllog
6grep -qP "^\t/" log && cp $(grep -P "^\t/" log | sed 's/^\t//') .6grep -qP "^\t/" log && cp $(grep -P "^\t/" log | sed 's/^\t//') .
7mkdir -p clientlogs
8ls *.yaml >/dev/null 2>&1 && mv *.yaml clientlogs
7sudo /usr/share/utah/examples/utah_syslog.sh "$NAME" > syslog9sudo /usr/share/utah/examples/utah_syslog.sh "$NAME" > syslog
8exit 010exit 0
911
=== modified file 'utah/provisioning/provisioning.py'
--- utah/provisioning/provisioning.py 2012-11-16 15:44:03 +0000
+++ utah/provisioning/provisioning.py 2012-11-16 21:27:24 +0000
@@ -244,14 +244,14 @@
244 self.logger.removeHandler(handler)244 self.logger.removeHandler(handler)
245 del handler245 del handler
246 self.consolehandler = logging.StreamHandler(stream=sys.stderr)246 self.consolehandler = logging.StreamHandler(stream=sys.stderr)
247 console_formatter = logging.Formatter('%(levelname)s: %(message)s')247 log_format = logging.Formatter('%(asctime)s ' + self.name
248 + ' %(levelname)s: %(message)s')
249 console_formatter = log_format
248 self.consolehandler.setFormatter(console_formatter)250 self.consolehandler.setFormatter(console_formatter)
249 self.consolehandler.setLevel(config.consoleloglevel)251 self.consolehandler.setLevel(config.consoleloglevel)
250 self.logger.addHandler(self.consolehandler)252 self.logger.addHandler(self.consolehandler)
251 self.filehandler = logging.handlers.WatchedFileHandler(config.logfile)253 self.filehandler = logging.handlers.WatchedFileHandler(config.logfile)
252 file_formatter = logging.Formatter('%(asctime)s '254 file_formatter = log_format
253 + self.name
254 + ' %(levelname)s: %(message)s')
255 self.filehandler.setFormatter(file_formatter)255 self.filehandler.setFormatter(file_formatter)
256 self.filehandler.setLevel(config.fileloglevel)256 self.filehandler.setLevel(config.fileloglevel)
257 self.logger.addHandler(self.filehandler)257 self.logger.addHandler(self.filehandler)
258258
=== modified file 'utah/run.py'
--- utah/run.py 2012-11-16 15:39:51 +0000
+++ utah/run.py 2012-11-16 21:27:24 +0000
@@ -58,6 +58,9 @@
58 f.write(stdout)58 f.write(stdout)
59 machine.logger.info('Test log copied to ' + locallog)59 machine.logger.info('Test log copied to ' + locallog)
60 locallogs.append(locallog)60 locallogs.append(locallog)
61 if args.dumplogs:
62 with open(locallog, 'r') as f:
63 print(f.read())
6164
62 if args.files is not None:65 if args.files is not None:
63 try:66 try:

Subscribers

People subscribed via source and target branches