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
1=== modified file 'examples/run_install_test.py'
2--- examples/run_install_test.py 2012-11-16 15:39:51 +0000
3+++ examples/run_install_test.py 2012-11-16 21:27:24 +0000
4@@ -77,6 +77,8 @@
5 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',
6 'none'), help='Enable or disable automatic '
7 'configuration rewriting')
8+ parser.add_argument('--dumplogs', action='store_true',
9+ help='Write client output logs to standard out')
10 return parser
11
12
13
14=== modified file 'examples/run_test_bamboo_feeder.py'
15--- examples/run_test_bamboo_feeder.py 2012-11-14 16:14:38 +0000
16+++ examples/run_test_bamboo_feeder.py 2012-11-16 21:27:24 +0000
17@@ -48,6 +48,8 @@
18 help='Enable debug logging')
19 parser.add_argument('-j', '--json', action='store_true',
20 help='Enable json logging (default is YAML)')
21+ parser.add_argument('--dumplogs', action='store_true',
22+ help='Write client output logs to standard out')
23 return parser
24
25
26
27=== modified file 'examples/run_test_cobbler.py'
28--- examples/run_test_cobbler.py 2012-11-16 15:39:51 +0000
29+++ examples/run_test_cobbler.py 2012-11-16 21:27:24 +0000
30@@ -54,6 +54,8 @@
31 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',
32 'none'), help='Enable or disable automatic '
33 'configuration rewriting')
34+ parser.add_argument('--dumplogs', action='store_true',
35+ help='Write client output logs to standard out')
36 return parser
37
38
39
40=== modified file 'examples/run_test_vm.py'
41--- examples/run_test_vm.py 2012-11-16 15:39:51 +0000
42+++ examples/run_test_vm.py 2012-11-16 21:27:24 +0000
43@@ -45,6 +45,8 @@
44 parser.add_argument('-o', '--outdir',
45 help=('Directory to store locally copied files '
46 '(Default is ' + config.logpath + '/machine-name)'))
47+ parser.add_argument('--dumplogs', action='store_true',
48+ help='Write client output logs to standard out')
49 return parser
50
51
52
53=== modified file 'examples/run_utah_tests.py'
54--- examples/run_utah_tests.py 2012-11-16 15:39:51 +0000
55+++ examples/run_utah_tests.py 2012-11-16 21:27:24 +0000
56@@ -81,6 +81,8 @@
57 parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly',
58 'none'), help='Enable or disable automatic '
59 'configuration rewriting')
60+ parser.add_argument('--dumplogs', action='store_true',
61+ help='Write client output logs to standard out')
62 return parser
63
64
65
66=== modified file 'examples/utah_logs.sh'
67--- examples/utah_logs.sh 2012-07-31 14:26:27 +0000
68+++ examples/utah_logs.sh 2012-11-16 21:27:24 +0000
69@@ -4,5 +4,7 @@
70 NAME=$(grep -m1 -o "utah-[0-9]*" log)
71 grep "$NAME" /var/log/utah/$(hostname).log* > fulllog
72 grep -qP "^\t/" log && cp $(grep -P "^\t/" log | sed 's/^\t//') .
73+mkdir -p clientlogs
74+ls *.yaml >/dev/null 2>&1 && mv *.yaml clientlogs
75 sudo /usr/share/utah/examples/utah_syslog.sh "$NAME" > syslog
76 exit 0
77
78=== modified file 'utah/provisioning/provisioning.py'
79--- utah/provisioning/provisioning.py 2012-11-16 15:44:03 +0000
80+++ utah/provisioning/provisioning.py 2012-11-16 21:27:24 +0000
81@@ -244,14 +244,14 @@
82 self.logger.removeHandler(handler)
83 del handler
84 self.consolehandler = logging.StreamHandler(stream=sys.stderr)
85- console_formatter = logging.Formatter('%(levelname)s: %(message)s')
86+ log_format = logging.Formatter('%(asctime)s ' + self.name
87+ + ' %(levelname)s: %(message)s')
88+ console_formatter = log_format
89 self.consolehandler.setFormatter(console_formatter)
90 self.consolehandler.setLevel(config.consoleloglevel)
91 self.logger.addHandler(self.consolehandler)
92 self.filehandler = logging.handlers.WatchedFileHandler(config.logfile)
93- file_formatter = logging.Formatter('%(asctime)s '
94- + self.name
95- + ' %(levelname)s: %(message)s')
96+ file_formatter = log_format
97 self.filehandler.setFormatter(file_formatter)
98 self.filehandler.setLevel(config.fileloglevel)
99 self.logger.addHandler(self.filehandler)
100
101=== modified file 'utah/run.py'
102--- utah/run.py 2012-11-16 15:39:51 +0000
103+++ utah/run.py 2012-11-16 21:27:24 +0000
104@@ -58,6 +58,9 @@
105 f.write(stdout)
106 machine.logger.info('Test log copied to ' + locallog)
107 locallogs.append(locallog)
108+ if args.dumplogs:
109+ with open(locallog, 'r') as f:
110+ print(f.read())
111
112 if args.files is not None:
113 try:

Subscribers

People subscribed via source and target branches