Status: | Merged |
---|---|
Approved by: | Javier Collado |
Approved revision: | 774 |
Merged at revision: | 775 |
Proposed branch: | lp:~xnox/utah/new-pep8 |
Merge into: | lp:utah |
Diff against target: |
2328 lines (+551/-520) 37 files modified
examples/run_install_test.py (+21/-19) examples/run_test_bamboo_feeder.py (+11/-11) examples/run_test_cobbler.py (+12/-11) examples/run_test_vm.py (+12/-11) examples/run_utah_tests.py (+15/-14) setup.py (+6/-5) tests/test_parser.py (+1/-0) utah/client/common.py (+26/-24) utah/client/phoenix.py (+22/-21) utah/client/result.py (+23/-23) utah/client/runner.py (+32/-32) utah/client/testcase.py (+51/-49) utah/client/tests/__init__.py (+0/-1) utah/client/tests/common.py (+7/-6) utah/client/tests/manual_privileges.py (+2/-2) utah/client/tests/test_common.py (+7/-7) utah/client/tests/test_jsonschema.py (+6/-6) utah/client/tests/test_phoenix.py (+10/-10) utah/client/tests/test_result.py (+3/-3) utah/client/tests/test_runner.py (+9/-8) utah/client/tests/test_state_agent.py (+42/-37) utah/client/tests/test_testcase.py (+33/-32) utah/client/tests/test_testsuite.py (+32/-24) utah/client/tests/test_yaml.py (+36/-36) utah/client/testsuite.py (+10/-10) utah/config.py (+15/-13) utah/iso.py (+4/-4) utah/isotest/iso_static_validation.py (+2/-2) utah/orderedcollections.py (+2/-2) utah/process.py (+5/-5) utah/provisioning/baremetal/bamboofeeder.py (+30/-30) utah/provisioning/baremetal/cobbler.py (+14/-15) utah/provisioning/baremetal/power.py (+0/-1) utah/provisioning/inventory/inventory.py (+5/-5) utah/provisioning/inventory/sqlite.py (+29/-27) utah/publish.py (+10/-10) utah/timeout.py (+6/-4) |
To merge this branch: | bzr merge lp:~xnox/utah/new-pep8 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Javier Collado (community) | Approve | ||
Review via email: mp+138850@code.launchpad.net |
Commit message
Description of the change
New pep8 in raring is more strict about whitespace.
Here are some fixes.
To post a comment you must log in.
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-12-03 15:49:35 +0000 |
3 | +++ examples/run_install_test.py 2012-12-08 02:12:21 +0000 |
4 | @@ -29,15 +29,15 @@ |
5 | |
6 | def get_parser(): |
7 | parser = argparse.ArgumentParser( |
8 | - description=('Provision a machine ' |
9 | - 'and run one or more UTAH runlists there.'), |
10 | - epilog=("For example:\n" |
11 | - "Provision a VM using a precise server image " |
12 | - "with i386 architecture and run the two given runlists\n" |
13 | - "\t%(prog)s -s precise -t server -a i386 \\\n" |
14 | - "\t\t/usr/share/utah/client/examples/master.run \\\n" |
15 | - "\t\t'http://people.canonical.com/~max/max_test.run'"), |
16 | - formatter_class=argparse.RawDescriptionHelpFormatter) |
17 | + description=('Provision a machine ' |
18 | + 'and run one or more UTAH runlists there.'), |
19 | + epilog=("For example:\n" |
20 | + "Provision a VM using a precise server image " |
21 | + "with i386 architecture and run the two given runlists\n" |
22 | + "\t%(prog)s -s precise -t server -a i386 \\\n" |
23 | + "\t\t/usr/share/utah/client/examples/master.run \\\n" |
24 | + "\t\t'http://people.canonical.com/~max/max_test.run'"), |
25 | + formatter_class=argparse.RawDescriptionHelpFormatter) |
26 | parser.add_argument('runlists', metavar='runlist', nargs='+', |
27 | type=url_argument, help='URLs of runlist files to run') |
28 | parser.add_argument('-m', '--machinetype', metavar='MACHINETYPE', |
29 | @@ -82,9 +82,10 @@ |
30 | help='Enable json logging (default is YAML)') |
31 | parser.add_argument('-f', '--files', action='append', |
32 | help='File or directory to copy from test system ') |
33 | - parser.add_argument('-o', '--outdir', |
34 | + parser.add_argument('-o', '--outdir', |
35 | help=('Directory to store locally copied files ' |
36 | - '(Default is ' + config.logpath + '/machine-name)')) |
37 | + '(Default is ' + config.logpath + |
38 | + '/machine-name)')) |
39 | parser.add_argument('--diskbus', metavar='DISKBUS', |
40 | choices=('virtio', 'sata', 'ide'), |
41 | help=('Disk bus to use for customvm installation ' |
42 | @@ -111,14 +112,15 @@ |
43 | |
44 | try: |
45 | inventory = TinySQLiteInventory() |
46 | - machine = inventory.request(CustomVM, |
47 | - arch=args.arch, boot=args.boot, clean=(not args.no_destroy), |
48 | - debug=args.debug, diskbus=args.diskbus, |
49 | - disksizes=args.gigabytes, dlpercentincrement=10, |
50 | - emulator=args.emulator, image=args.image, initrd=args.initrd, |
51 | - installtype=args.type, kernel=args.kernel, new=True, |
52 | - preseed=args.preseed, rewrite=args.rewrite, |
53 | - series=args.series, xml=args.xml) |
54 | + machine = inventory.request( |
55 | + CustomVM, |
56 | + arch=args.arch, boot=args.boot, clean=(not args.no_destroy), |
57 | + debug=args.debug, diskbus=args.diskbus, |
58 | + disksizes=args.gigabytes, dlpercentincrement=10, |
59 | + emulator=args.emulator, image=args.image, initrd=args.initrd, |
60 | + installtype=args.type, kernel=args.kernel, new=True, |
61 | + preseed=args.preseed, rewrite=args.rewrite, |
62 | + series=args.series, xml=args.xml) |
63 | exitstatus, locallogs = run_tests(args, machine) |
64 | |
65 | except UTAHException as error: |
66 | |
67 | === modified file 'examples/run_test_bamboo_feeder.py' |
68 | --- examples/run_test_bamboo_feeder.py 2012-12-03 15:49:35 +0000 |
69 | +++ examples/run_test_bamboo_feeder.py 2012-12-08 02:12:21 +0000 |
70 | @@ -30,15 +30,15 @@ |
71 | |
72 | def get_parser(): |
73 | parser = argparse.ArgumentParser( |
74 | - description=('Provision a pandaboard in a bamboo-feeder setup ' |
75 | - 'and run one or more UTAH runlists there.'), |
76 | - epilog=("For example:\n" |
77 | - "Provision a machine using a precise server image " |
78 | - "with i386 architecture and run the two given runlists\n" |
79 | - "\t%(prog)s -s precise -t server -a i386 \\\n" |
80 | - "\t\t/usr/share/utah/client/examples/master.run \\\n" |
81 | - "\t\t'http://people.canonical.com/~max/max_test.run'"), |
82 | - formatter_class=argparse.RawDescriptionHelpFormatter) |
83 | + description=('Provision a pandaboard in a bamboo-feeder setup ' |
84 | + 'and run one or more UTAH runlists there.'), |
85 | + epilog=("For example:\n" |
86 | + "Provision a machine using a precise server image " |
87 | + "with i386 architecture and run the two given runlists\n" |
88 | + "\t%(prog)s -s precise -t server -a i386 \\\n" |
89 | + "\t\t/usr/share/utah/client/examples/master.run \\\n" |
90 | + "\t\t'http://people.canonical.com/~max/max_test.run'"), |
91 | + formatter_class=argparse.RawDescriptionHelpFormatter) |
92 | parser.add_argument('runlists', metavar='runlist', nargs='+', |
93 | help='URLs of runlist files to run') |
94 | parser.add_argument('-s', '--series', metavar='SERIES', |
95 | @@ -82,8 +82,8 @@ |
96 | |
97 | try: |
98 | inventory = ManualCobblerSQLiteInventory( |
99 | - db=os.path.join('~', '.utah-bamboofeeder-inventory'), |
100 | - lockfile=os.path.join('~', '.utah-bamboofeeder-lock')) |
101 | + db=os.path.join('~', '.utah-bamboofeeder-inventory'), |
102 | + lockfile=os.path.join('~', '.utah-bamboofeeder-lock')) |
103 | kw = {} |
104 | for arg in ['image', 'preseed']: |
105 | value = vars(args)[arg] |
106 | |
107 | === modified file 'examples/run_test_cobbler.py' |
108 | --- examples/run_test_cobbler.py 2012-12-03 15:49:35 +0000 |
109 | +++ examples/run_test_cobbler.py 2012-12-08 02:12:21 +0000 |
110 | @@ -28,15 +28,15 @@ |
111 | |
112 | def get_parser(): |
113 | parser = argparse.ArgumentParser( |
114 | - description=('Provision a machine using cobbler ' |
115 | - 'and run one or more UTAH runlists there.'), |
116 | - epilog=("For example:\n" |
117 | - "Provision a machine using a precise server image " |
118 | - "with i386 architecture and run the two given runlists\n" |
119 | - "\t%(prog)s -s precise -t server -a i386 \\\n" |
120 | - "\t\t/usr/share/utah/client/examples/master.run \\\n" |
121 | - "\t\t'http://people.canonical.com/~max/max_test.run'"), |
122 | - formatter_class=argparse.RawDescriptionHelpFormatter) |
123 | + description=('Provision a machine using cobbler ' |
124 | + 'and run one or more UTAH runlists there.'), |
125 | + epilog=("For example:\n" |
126 | + "Provision a machine using a precise server image " |
127 | + "with i386 architecture and run the two given runlists\n" |
128 | + "\t%(prog)s -s precise -t server -a i386 \\\n" |
129 | + "\t\t/usr/share/utah/client/examples/master.run \\\n" |
130 | + "\t\t'http://people.canonical.com/~max/max_test.run'"), |
131 | + formatter_class=argparse.RawDescriptionHelpFormatter) |
132 | parser.add_argument('runlists', metavar='runlist', nargs='+', |
133 | help='URLs of runlist files to run') |
134 | parser.add_argument('-n', '--name', help='Name of machine to provision') |
135 | @@ -63,9 +63,10 @@ |
136 | help='Enable json logging (default is YAML)') |
137 | parser.add_argument('-f', '--files', action='append', |
138 | help='File or directory to copy from test system ') |
139 | - parser.add_argument('-o', '--outdir', |
140 | + parser.add_argument('-o', '--outdir', |
141 | help=('Directory to store locally copied files ' |
142 | - '(Default is ' + config.logpath + '/machine-name)')) |
143 | + '(Default is ' + config.logpath + |
144 | + '/machine-name)')) |
145 | parser.add_argument('--rewrite', choices=('all', 'minimal', 'casperonly', |
146 | 'none'), help='Enable or disable automatic ' |
147 | 'configuration rewriting') |
148 | |
149 | === modified file 'examples/run_test_vm.py' |
150 | --- examples/run_test_vm.py 2012-12-03 15:49:35 +0000 |
151 | +++ examples/run_test_vm.py 2012-12-08 02:12:21 +0000 |
152 | @@ -27,15 +27,15 @@ |
153 | |
154 | def get_parser(): |
155 | parser = argparse.ArgumentParser( |
156 | - description=('Create a virtual machine ' |
157 | - 'and run a UTAH runlist there.'), |
158 | - epilog=("For example:\n" |
159 | - "Provision a VM using a precise server image " |
160 | - "with i386 architecture and run the two given runlists\n" |
161 | - "\t%(prog)s -s precise -t server -a i386 \\\n" |
162 | - "\t\t/usr/share/utah/client/examples/master.run \\\n" |
163 | - "\t\t'http://people.canonical.com/~max/max_test.run'"), |
164 | - formatter_class=argparse.RawDescriptionHelpFormatter) |
165 | + description=('Create a virtual machine ' |
166 | + 'and run a UTAH runlist there.'), |
167 | + epilog=("For example:\n" |
168 | + "Provision a VM using a precise server image " |
169 | + "with i386 architecture and run the two given runlists\n" |
170 | + "\t%(prog)s -s precise -t server -a i386 \\\n" |
171 | + "\t\t/usr/share/utah/client/examples/master.run \\\n" |
172 | + "\t\t'http://people.canonical.com/~max/max_test.run'"), |
173 | + formatter_class=argparse.RawDescriptionHelpFormatter) |
174 | parser.add_argument('runlists', metavar='runlist', nargs='+', |
175 | help='URLs of runlist files to run') |
176 | parser.add_argument('-s', '--series', metavar='SERIES', |
177 | @@ -57,9 +57,10 @@ |
178 | help='Enable json logging (default is YAML)') |
179 | parser.add_argument('-f', '--files', action='append', |
180 | help='File or directory to copy from test system ') |
181 | - parser.add_argument('-o', '--outdir', |
182 | + parser.add_argument('-o', '--outdir', |
183 | help=('Directory to store locally copied files ' |
184 | - '(Default is ' + config.logpath + '/machine-name)')) |
185 | + '(Default is ' + config.logpath + |
186 | + '/machine-name)')) |
187 | parser.add_argument('--dumplogs', action='store_true', |
188 | help='Write client output logs to standard out') |
189 | return parser |
190 | |
191 | === modified file 'examples/run_utah_tests.py' |
192 | --- examples/run_utah_tests.py 2012-12-03 15:49:35 +0000 |
193 | +++ examples/run_utah_tests.py 2012-12-08 02:12:21 +0000 |
194 | @@ -28,17 +28,17 @@ |
195 | |
196 | def get_parser(): |
197 | parser = argparse.ArgumentParser( |
198 | - description=('Provision a machine ' |
199 | - 'and run one or more UTAH runlists there.\n\n' |
200 | - 'The appropriate run_*.py script will be called, ' |
201 | - 'depending on the parameters passed.'), |
202 | - epilog=("For example:\n" |
203 | - "Provision a VM using a precise server image " |
204 | - "with i386 architecture and run the two given runlists\n" |
205 | - "\t%(prog)s -s precise -t server -a i386 \\\n" |
206 | - "\t\t/usr/share/utah/client/examples/master.run \\\n" |
207 | - "\t\t'http://people.canonical.com/~max/max_test.run'"), |
208 | - formatter_class=argparse.RawDescriptionHelpFormatter) |
209 | + description=('Provision a machine ' |
210 | + 'and run one or more UTAH runlists there.\n\n' |
211 | + 'The appropriate run_*.py script will be called, ' |
212 | + 'depending on the parameters passed.'), |
213 | + epilog=("For example:\n" |
214 | + "Provision a VM using a precise server image " |
215 | + "with i386 architecture and run the two given runlists\n" |
216 | + "\t%(prog)s -s precise -t server -a i386 \\\n" |
217 | + "\t\t/usr/share/utah/client/examples/master.run \\\n" |
218 | + "\t\t'http://people.canonical.com/~max/max_test.run'"), |
219 | + formatter_class=argparse.RawDescriptionHelpFormatter) |
220 | parser.add_argument('runlists', metavar='runlist', nargs='+', |
221 | type=url_argument, help='URLs of runlist files to run') |
222 | parser.add_argument('-m', '--machinetype', metavar='MACHINETYPE', |
223 | @@ -83,9 +83,10 @@ |
224 | help='Enable json logging (default is YAML)') |
225 | parser.add_argument('-f', '--files', action='append', |
226 | help='File or directory to copy from test system ') |
227 | - parser.add_argument('-o', '--outdir', |
228 | + parser.add_argument('-o', '--outdir', |
229 | help=('Directory to store locally copied files ' |
230 | - '(Default is ' + config.logpath + '/machine-name)')) |
231 | + '(Default is ' + config.logpath + |
232 | + '/machine-name)')) |
233 | parser.add_argument('--diskbus', metavar='DISKBUS', |
234 | choices=('virtio', 'sata', 'ide'), |
235 | help=('Disk bus to use for customvm installation ' |
236 | @@ -125,7 +126,7 @@ |
237 | # If machinetype is physical but arch isn't arm, use CobblerMachine |
238 | from run_test_cobbler import run_test_cobbler |
239 | function = run_test_cobbler |
240 | - |
241 | + |
242 | function(args=args) |
243 | |
244 | if __name__ == '__main__': |
245 | |
246 | === modified file 'setup.py' |
247 | --- setup.py 2012-12-03 15:49:35 +0000 |
248 | +++ setup.py 2012-12-08 02:12:21 +0000 |
249 | @@ -42,9 +42,10 @@ |
250 | maintainer = maintainer_info.rsplit('<', 1)[0].strip() |
251 | maintainer_email = maintainer_info.rsplit('<', 1)[1].strip('>') |
252 | |
253 | -setup(name='utah', |
254 | - version=version, |
255 | - packages=find_packages(), |
256 | - maintainer=maintainer, |
257 | - maintainer_email=maintainer_email, |
258 | +setup( |
259 | + name='utah', |
260 | + version=version, |
261 | + packages=find_packages(), |
262 | + maintainer=maintainer, |
263 | + maintainer_email=maintainer_email, |
264 | ) |
265 | |
266 | === modified file 'tests/test_parser.py' |
267 | --- tests/test_parser.py 2012-12-06 16:30:34 +0000 |
268 | +++ tests/test_parser.py 2012-12-08 02:12:21 +0000 |
269 | @@ -26,6 +26,7 @@ |
270 | good: |
271 | """ |
272 | |
273 | + |
274 | class TestParser(unittest.TestCase): |
275 | def setUp(self): |
276 | self.logfile = '/tmp/utah.yaml' |
277 | |
278 | === modified file 'utah/client/common.py' |
279 | --- utah/client/common.py 2012-12-06 16:30:34 +0000 |
280 | +++ utah/client/common.py 2012-12-08 02:12:21 +0000 |
281 | @@ -31,9 +31,9 @@ |
282 | import jsonschema |
283 | |
284 | from utah.client.exceptions import ( |
285 | - YAMLParsingError, |
286 | - YAMLEmptyFile, |
287 | - ) |
288 | + YAMLParsingError, |
289 | + YAMLEmptyFile, |
290 | +) |
291 | |
292 | |
293 | PASS = 0 |
294 | @@ -138,7 +138,7 @@ |
295 | time_delta=str(time_delta), |
296 | cmd_type=cmd_type, |
297 | user=run_as, |
298 | - ) |
299 | + ) |
300 | |
301 | time_delta = datetime.datetime.now() - start_time |
302 | |
303 | @@ -150,7 +150,7 @@ |
304 | time_delta=str(time_delta), |
305 | cmd_type=cmd_type, |
306 | user=run_as, |
307 | - ) |
308 | + ) |
309 | |
310 | |
311 | def normalize_encoding(value, encoding='utf-8'): |
312 | @@ -394,9 +394,9 @@ |
313 | uname = platform.uname() |
314 | |
315 | arch = { |
316 | - 'x86_64': 'amd64', |
317 | - 'x86': 'i386', |
318 | - }.get(uname[5]) # 5 == processor |
319 | + 'x86_64': 'amd64', |
320 | + 'x86': 'i386', |
321 | + }.get(uname[5]) # 5 == processor |
322 | |
323 | return arch |
324 | |
325 | @@ -404,7 +404,7 @@ |
326 | def get_arch(): |
327 | """ |
328 | The host's architecture. |
329 | - |
330 | + |
331 | Returns the human readable architecture or 'unknown'. |
332 | """ |
333 | arches = { |
334 | @@ -415,6 +415,7 @@ |
335 | |
336 | return arches.get(platform.machine(), 'unknown') |
337 | |
338 | + |
339 | def get_release(): |
340 | """ |
341 | The host's release name (i.e. precise, quantal, etc.) |
342 | @@ -493,18 +494,18 @@ |
343 | |
344 | if branch: |
345 | self.get_command = "bzr branch {} {} {}".format( |
346 | - options, |
347 | - self.repo, |
348 | - destination, |
349 | - ) |
350 | + options, |
351 | + self.repo, |
352 | + destination, |
353 | + ) |
354 | |
355 | self.rev_command = "bzr revno" |
356 | else: |
357 | self.get_command = "bzr export {} {} {}".format( |
358 | - options, |
359 | - destination, |
360 | - self.repo, |
361 | - ) |
362 | + options, |
363 | + destination, |
364 | + self.repo, |
365 | + ) |
366 | |
367 | self.rev_command = "bzr revno {}".format(self.repo) |
368 | |
369 | @@ -520,13 +521,14 @@ |
370 | self.destination = destination |
371 | |
372 | self.get_command = "git clone {} {} {}".format( |
373 | - options, |
374 | - self.repo, |
375 | - destination, |
376 | - ) |
377 | + options, |
378 | + self.repo, |
379 | + destination, |
380 | + ) |
381 | |
382 | self.rev_command = "git rev-parse HEAD" |
383 | |
384 | + |
385 | class DevHandler(VCSHandler): |
386 | """ Copy from a local directory for development. """ |
387 | |
388 | @@ -535,8 +537,8 @@ |
389 | self.destination = destination |
390 | |
391 | self.get_command = "cp -r {} {}".format( |
392 | - self.repo, |
393 | - destination, |
394 | - ) |
395 | + self.repo, |
396 | + destination, |
397 | + ) |
398 | |
399 | self.rev_command = "echo 'DEVELOPMENT'" |
400 | |
401 | === modified file 'utah/client/phoenix.py' |
402 | --- utah/client/phoenix.py 2012-12-03 15:49:35 +0000 |
403 | +++ utah/client/phoenix.py 2012-12-08 02:12:21 +0000 |
404 | @@ -51,26 +51,26 @@ |
405 | timeout: 60 |
406 | command: {0} |
407 | run_as: {0} |
408 | -#build_cmd: |
409 | -#tc_setup: |
410 | -#tc_cleanup: |
411 | +#build_cmd: |
412 | +#tc_setup: |
413 | +#tc_cleanup: |
414 | """.format(CHANGEME) |
415 | self.master_run_content = """--- |
416 | testsuites: |
417 | """ |
418 | |
419 | self.FILE_CONTENT = { |
420 | - TSLIST_NAME: self.tslist_content, |
421 | - TS_CONTROL_NAME: self.ts_control_content, |
422 | - TC_CONTROL_NAME: self.tc_control_content, |
423 | - MASTER_NAME: self.master_run_content, |
424 | - } |
425 | + TSLIST_NAME: self.tslist_content, |
426 | + TS_CONTROL_NAME: self.ts_control_content, |
427 | + TC_CONTROL_NAME: self.tc_control_content, |
428 | + MASTER_NAME: self.master_run_content, |
429 | + } |
430 | |
431 | self.FILES = [ |
432 | - TSLIST_NAME, |
433 | - TS_CONTROL_NAME, |
434 | - MASTER_NAME, |
435 | - ] |
436 | + TSLIST_NAME, |
437 | + TS_CONTROL_NAME, |
438 | + MASTER_NAME, |
439 | + ] |
440 | # Add testcase files |
441 | for d in self.testcases: |
442 | self.FILES.append(os.path.join(d, TC_CONTROL_NAME)) |
443 | @@ -78,9 +78,9 @@ |
444 | |
445 | self.FILE_CONTENT[MASTER_NAME] += " - name: {}\n".format(testsuite) |
446 | self.FILE_CONTENT[MASTER_NAME] += \ |
447 | - " fetch_method: {} # one of 'bzr', 'bzr-export', 'dev', 'git'\n".format(CHANGEME) |
448 | + " fetch_method: {} # one of 'bzr', 'bzr-export', 'dev', 'git'\n".format(CHANGEME) |
449 | self.FILE_CONTENT[MASTER_NAME] += \ |
450 | - " fetch_location: {}\n".format(CHANGEME) |
451 | + " fetch_location: {}\n".format(CHANGEME) |
452 | |
453 | def debug(self): |
454 | for f in self.FILE_CONTENT.keys(): |
455 | @@ -112,7 +112,8 @@ |
456 | |
457 | # create the tslist.run file |
458 | tslist_file = os.path.join(ts_dir, TSLIST_NAME) |
459 | - self.create_file(tslist_file, self.FILE_CONTENT[TSLIST_NAME], append_if_exists=True) |
460 | + self.create_file(tslist_file, self.FILE_CONTENT[TSLIST_NAME], |
461 | + append_if_exists=True) |
462 | |
463 | # create the test case directories |
464 | for tc in self.testcases: |
465 | @@ -130,18 +131,18 @@ |
466 | |
467 | parser = argparse.ArgumentParser(description='phoenix bootstrapper') |
468 | parser.add_argument('testsuite', metavar='TESTSUITE', type=str, nargs=1, |
469 | - help='name of the testsuite to create') |
470 | + help='name of the testsuite to create') |
471 | parser.add_argument('testcases', metavar='TESTCASE', type=str, nargs='*', |
472 | - help='names of testcases to create') |
473 | + help='names of testcases to create') |
474 | parser.add_argument('--directory', '-D', dest='directory', default='.', |
475 | - help='where to create the testsuite') |
476 | + help='where to create the testsuite') |
477 | |
478 | args = parser.parse_args() |
479 | |
480 | phoenix = Phoenix(args.testsuite[0], |
481 | - directory=args.directory, |
482 | - testcases=args.testcases, |
483 | - ) |
484 | + directory=args.directory, |
485 | + testcases=args.testcases, |
486 | + ) |
487 | phoenix.build_suite() |
488 | |
489 | if __name__ == "__main__": |
490 | |
491 | === modified file 'utah/client/result.py' |
492 | --- utah/client/result.py 2012-12-06 16:30:34 +0000 |
493 | +++ utah/client/result.py 2012-12-08 02:12:21 +0000 |
494 | @@ -18,11 +18,11 @@ |
495 | import yaml |
496 | |
497 | from .common import ( |
498 | - get_host_info, |
499 | - get_build_number, |
500 | - get_release, |
501 | - get_arch, |
502 | - ) |
503 | + get_host_info, |
504 | + get_build_number, |
505 | + get_release, |
506 | + get_arch, |
507 | +) |
508 | |
509 | |
510 | def get_smoke_data(_result): |
511 | @@ -48,9 +48,9 @@ |
512 | return None |
513 | |
514 | type_map = { |
515 | - 'smoke': get_smoke_data, |
516 | - 'kernel-sru': get_kernel_sru_data, |
517 | - } |
518 | + 'smoke': get_smoke_data, |
519 | + 'kernel-sru': get_kernel_sru_data, |
520 | + } |
521 | |
522 | if publish_type and publish_type in type_map.iterkeys(): |
523 | return type_map[publish_type](result) |
524 | @@ -61,7 +61,7 @@ |
525 | Result collection class. |
526 | """ |
527 | def __init__(self, name=None, testsuite=None, testcase=None, |
528 | - runlist=None, publish_type=None, install_type=None): |
529 | + runlist=None, publish_type=None, install_type=None): |
530 | self.results = [] |
531 | self.status = 'PASS' |
532 | self.name = name |
533 | @@ -188,20 +188,20 @@ |
534 | """ |
535 | host_info = get_host_info() |
536 | data = { |
537 | - 'runlist': self.runlist, |
538 | - 'commands': self.results, |
539 | - 'errors': self.errors, |
540 | - 'failures': self.failures, |
541 | - 'fetch_errors': self.fetch_errors, |
542 | - 'passes': self.passes, |
543 | - 'uname': list(host_info['uname']), |
544 | - 'media-info': host_info['media-info'], |
545 | - 'install_type': self.install_type, |
546 | - 'build_number': get_build_number(), |
547 | - 'release': get_release(), |
548 | - 'ran_at': self.results[0]['start_time'], |
549 | - 'arch': get_arch(), |
550 | - 'name': self.name, |
551 | + 'runlist': self.runlist, |
552 | + 'commands': self.results, |
553 | + 'errors': self.errors, |
554 | + 'failures': self.failures, |
555 | + 'fetch_errors': self.fetch_errors, |
556 | + 'passes': self.passes, |
557 | + 'uname': list(host_info['uname']), |
558 | + 'media-info': host_info['media-info'], |
559 | + 'install_type': self.install_type, |
560 | + 'build_number': get_build_number(), |
561 | + 'release': get_release(), |
562 | + 'ran_at': self.results[0]['start_time'], |
563 | + 'arch': get_arch(), |
564 | + 'name': self.name, |
565 | } |
566 | |
567 | if self.publish is not None: |
568 | |
569 | === modified file 'utah/client/runner.py' |
570 | --- utah/client/runner.py 2012-12-06 16:30:34 +0000 |
571 | +++ utah/client/runner.py 2012-12-08 02:12:21 +0000 |
572 | @@ -26,15 +26,15 @@ |
573 | import jsonschema |
574 | |
575 | from utah.client.common import ( |
576 | - MASTER_RUNLIST, |
577 | - UTAH_DIR, |
578 | - DEFAULT_STATE_FILE, |
579 | - RETURN_CODES, |
580 | - parse_yaml_file, |
581 | - BzrHandler, |
582 | - DevHandler, |
583 | - GitHandler, |
584 | - ) |
585 | + MASTER_RUNLIST, |
586 | + UTAH_DIR, |
587 | + DEFAULT_STATE_FILE, |
588 | + RETURN_CODES, |
589 | + parse_yaml_file, |
590 | + BzrHandler, |
591 | + DevHandler, |
592 | + GitHandler, |
593 | +) |
594 | |
595 | RC_LOCAL = '/etc/rc.local' |
596 | RC_LOCAL_BACKUP = '%s-utah.bak' % RC_LOCAL |
597 | @@ -63,24 +63,24 @@ |
598 | 'name': { |
599 | 'type': 'string', |
600 | 'required': True, |
601 | - }, |
602 | + }, |
603 | 'fetch_method': { |
604 | 'type': 'string', |
605 | 'enum': ['bzr', 'bzr-export', 'dev', 'git'], |
606 | 'required': True, |
607 | - }, |
608 | + }, |
609 | 'fetch_location': { |
610 | 'type': 'string', |
611 | 'required': True, |
612 | - }, |
613 | + }, |
614 | 'include_tests': { |
615 | 'type': 'array', |
616 | 'items': {'type': 'string'}, |
617 | - }, |
618 | + }, |
619 | 'exclude_tests': { |
620 | 'type': 'array', |
621 | 'items': {'type': 'string'}, |
622 | - }, |
623 | + }, |
624 | }, |
625 | } |
626 | |
627 | @@ -99,7 +99,7 @@ |
628 | 'items': { |
629 | 'type': [TESTSUITE_ENTRY_SCHEMA, TESTSUITE_INCLUDE_SCHEMA], |
630 | 'required': True, |
631 | - }, |
632 | + }, |
633 | } |
634 | |
635 | MASTER_RUNLIST_SCHEMA_NEW = { |
636 | @@ -108,33 +108,33 @@ |
637 | "timeout": { |
638 | "type": "integer", |
639 | "minimum": 0, |
640 | - }, |
641 | + }, |
642 | "repeat_count": { |
643 | "type": "integer", |
644 | "minimum": 0, |
645 | - }, |
646 | + }, |
647 | "type": { |
648 | 'type': 'string', |
649 | 'enum': ['smoke', 'kernel-sru', 'bootspeed', 'upgrade'], |
650 | - }, |
651 | + }, |
652 | "name": { |
653 | 'type': 'string', |
654 | - }, |
655 | + }, |
656 | "testsuites": { |
657 | # must be a list to accept a schema rather than a simple type |
658 | "type": [MASTER_RUNLIST_SCHEMA_ORIG], |
659 | "required": True, |
660 | - }, |
661 | - } |
662 | + }, |
663 | } |
664 | + } |
665 | |
666 | MASTER_RUNLIST_SCHEMA = { |
667 | - 'type': [MASTER_RUNLIST_SCHEMA_ORIG, MASTER_RUNLIST_SCHEMA_NEW], |
668 | - 'required': True, |
669 | - } |
670 | + 'type': [MASTER_RUNLIST_SCHEMA_ORIG, MASTER_RUNLIST_SCHEMA_NEW], |
671 | + 'required': True, |
672 | + } |
673 | |
674 | def __init__(self, install_type, runlist=None, result_class=Result, |
675 | - testdir=UTAH_DIR, state_agent=None, resume=False): |
676 | + testdir=UTAH_DIR, state_agent=None, resume=False): |
677 | |
678 | # Runlist URL passed through the command line |
679 | self.testdir = testdir |
680 | @@ -318,8 +318,9 @@ |
681 | |
682 | self.backup_runlist = os.path.join(self.testdir, 'master.run-reboot') |
683 | |
684 | - if (os.path.exists(self.master_runlist) |
685 | - and self.master_runlist != self.backup_runlist): |
686 | + if (os.path.exists( |
687 | + self.master_runlist) |
688 | + and self.master_runlist != self.backup_runlist): |
689 | shutil.copyfile(self.master_runlist, self.backup_runlist) |
690 | |
691 | state = { |
692 | @@ -374,9 +375,9 @@ |
693 | jsonschema.validate(data, self.MASTER_RUNLIST_SCHEMA) |
694 | except jsonschema.ValidationError as exception: |
695 | raise exceptions.ValidationError( |
696 | - 'Master runlist failed to validate: {!r}\n' |
697 | - 'Detailed information: {}' |
698 | - .format(local_filename, exception)) |
699 | + 'Master runlist failed to validate: {!r}\n' |
700 | + 'Detailed information: {}' |
701 | + .format(local_filename, exception)) |
702 | |
703 | if 'timeout' in data: |
704 | self.timeout = int(data['timeout']) |
705 | @@ -417,7 +418,7 @@ |
706 | vcs_handler = BzrHandler(repo=fetch_location, destination=name) |
707 | elif fetch_method == 'bzr-export': |
708 | vcs_handler = BzrHandler(branch=False, |
709 | - repo=fetch_location, destination=name) |
710 | + repo=fetch_location, destination=name) |
711 | elif fetch_method == 'dev': |
712 | vcs_handler = DevHandler(repo=fetch_location, destination=name) |
713 | else: |
714 | @@ -467,7 +468,6 @@ |
715 | _reboot_callback=self.reboot) |
716 | self.add_suite(s) |
717 | |
718 | - |
719 | def get_next_suite(self): |
720 | """ |
721 | Return the next suite to be run. |
722 | |
723 | === modified file 'utah/client/testcase.py' |
724 | --- utah/client/testcase.py 2012-12-06 16:30:34 +0000 |
725 | +++ utah/client/testcase.py 2012-12-08 02:12:21 +0000 |
726 | @@ -19,19 +19,19 @@ |
727 | import jsonschema |
728 | |
729 | from utah.client.common import ( |
730 | - run_cmd, |
731 | - parse_control_file, |
732 | - do_nothing, |
733 | - CMD_TC_BUILD, |
734 | - CMD_TC_SETUP, |
735 | - CMD_TC_TEST, |
736 | - CMD_TC_CLEANUP, |
737 | - ) |
738 | + run_cmd, |
739 | + parse_control_file, |
740 | + do_nothing, |
741 | + CMD_TC_BUILD, |
742 | + CMD_TC_SETUP, |
743 | + CMD_TC_TEST, |
744 | + CMD_TC_CLEANUP, |
745 | +) |
746 | from utah.client.exceptions import ( |
747 | - MissingFile, |
748 | - ValidationError, |
749 | - MissingData, |
750 | - ) |
751 | + MissingFile, |
752 | + ValidationError, |
753 | + MissingData, |
754 | +) |
755 | |
756 | |
757 | class TestCase(object): |
758 | @@ -42,7 +42,7 @@ |
759 | """ |
760 | |
761 | status = 'NOTRUN' |
762 | - summary = 'PASS' # 'PASS', 'FAIL', of 'ERROR' |
763 | + summary = 'PASS' # 'PASS', 'FAIL', of 'ERROR' |
764 | build_cmd = None |
765 | tc_setup = None |
766 | tc_cleanup = None |
767 | @@ -57,41 +57,41 @@ |
768 | 'description': { |
769 | 'type': 'string', |
770 | 'required': True, |
771 | - }, |
772 | + }, |
773 | 'dependencies': { |
774 | 'type': 'string', |
775 | 'required': True, |
776 | - }, |
777 | + }, |
778 | 'action': { |
779 | 'type': 'string', |
780 | 'required': True, |
781 | - }, |
782 | + }, |
783 | 'expected_results': { |
784 | 'type': 'string', |
785 | 'required': True, |
786 | - }, |
787 | + }, |
788 | 'type': { |
789 | 'type': 'string', |
790 | 'enum': ['userland'] |
791 | - }, |
792 | + }, |
793 | 'timeout': {'type': 'integer'}, |
794 | 'build_cmd': {'type': 'string'}, |
795 | 'command': { |
796 | 'type': 'string', |
797 | 'required': True, |
798 | - }, |
799 | + }, |
800 | 'run_as': { |
801 | 'type': 'string', |
802 | 'required': True, |
803 | - }, |
804 | + }, |
805 | 'tc_setup': {'type': 'string'}, |
806 | 'tc_cleanup': {'type': 'string'}, |
807 | 'reboot': { |
808 | 'type': 'string', |
809 | 'enum': ['always', 'pass', 'never'], |
810 | - }, |
811 | }, |
812 | - } |
813 | + }, |
814 | + } |
815 | |
816 | def __init__(self, name, path, result, command=None, timeout=None, |
817 | _control_data=None, _save_state_callback=None, |
818 | @@ -131,9 +131,9 @@ |
819 | self.CONTROL_SCHEMA) |
820 | except jsonschema.ValidationError as exception: |
821 | raise ValidationError( |
822 | - '{!r} test case control file invalid: {!r}\n' |
823 | - 'Detailed information: {}' |
824 | - .format(self.name, self.filename, exception)) |
825 | + '{!r} test case control file invalid: {!r}\n' |
826 | + 'Detailed information: {}' |
827 | + .format(self.name, self.filename, exception)) |
828 | else: |
829 | raise MissingFile(self.filename) |
830 | else: |
831 | @@ -239,20 +239,20 @@ |
832 | self.status = "RUN" |
833 | self.save_state_callback() |
834 | extra_info = { |
835 | - 'description': self.description, |
836 | - 'dependencies': self.dependencies, |
837 | - 'action': self.action, |
838 | - 'expected_results': self.expected_results, |
839 | - } |
840 | + 'description': self.description, |
841 | + 'dependencies': self.dependencies, |
842 | + 'action': self.action, |
843 | + 'expected_results': self.expected_results, |
844 | + } |
845 | result.add_result(run_cmd(self.command, |
846 | timeout=timeout, |
847 | cwd=self.working_dir, |
848 | cmd_type=CMD_TC_TEST, |
849 | run_as=self.run_as, |
850 | ), |
851 | - extra_info=extra_info) |
852 | + extra_info=extra_info) |
853 | |
854 | - # only if we haven't failed or errored so far do |
855 | + # only if we haven't failed or errored so far do |
856 | # we set the summary for the testcase. |
857 | if self.summary == 'PASS': |
858 | self.summary = result.status |
859 | @@ -261,9 +261,11 @@ |
860 | self.cleanup(result) |
861 | |
862 | need_reboot = False |
863 | - if (self.reboot == 'always' |
864 | - or self.reboot == 'pass' |
865 | - and result.status == 'PASS'): |
866 | + if ( |
867 | + self.reboot == 'always' |
868 | + or self.reboot == 'pass' |
869 | + and result.status == 'PASS' |
870 | + ): |
871 | need_reboot = True |
872 | |
873 | result.status = 'PASS' |
874 | @@ -299,20 +301,20 @@ |
875 | Returns a dictionary representing the test's state. |
876 | """ |
877 | state = { |
878 | - 'name': self.name, |
879 | - 'path': self.path, |
880 | - 'command': self.command, |
881 | - 'timeout': self.timeout, |
882 | - 'status': self.status, |
883 | - 'summary': self.summary, |
884 | - 'build_cmd': self.build_cmd, |
885 | - 'tc_setup': self.tc_setup, |
886 | - 'tc_cleanup': self.tc_cleanup, |
887 | - 'type': self.type, |
888 | - 'description': self.description, |
889 | - 'dependencies': self.dependencies, |
890 | - 'action': self.action, |
891 | - 'expected_results': self.expected_results, |
892 | + 'name': self.name, |
893 | + 'path': self.path, |
894 | + 'command': self.command, |
895 | + 'timeout': self.timeout, |
896 | + 'status': self.status, |
897 | + 'summary': self.summary, |
898 | + 'build_cmd': self.build_cmd, |
899 | + 'tc_setup': self.tc_setup, |
900 | + 'tc_cleanup': self.tc_cleanup, |
901 | + 'type': self.type, |
902 | + 'description': self.description, |
903 | + 'dependencies': self.dependencies, |
904 | + 'action': self.action, |
905 | + 'expected_results': self.expected_results, |
906 | } |
907 | |
908 | return state |
909 | |
910 | === modified file 'utah/client/tests/__init__.py' |
911 | --- utah/client/tests/__init__.py 2012-12-03 14:02:18 +0000 |
912 | +++ utah/client/tests/__init__.py 2012-12-08 02:12:21 +0000 |
913 | @@ -12,4 +12,3 @@ |
914 | |
915 | # You should have received a copy of the GNU General Public License along |
916 | # with this program. If not, see <http://www.gnu.org/licenses/>. |
917 | - |
918 | |
919 | === modified file 'utah/client/tests/common.py' |
920 | --- utah/client/tests/common.py 2012-12-06 16:30:34 +0000 |
921 | +++ utah/client/tests/common.py 2012-12-08 02:12:21 +0000 |
922 | @@ -105,6 +105,7 @@ |
923 | if os.path.exists(examples_dir): |
924 | shutil.rmtree(examples_dir) |
925 | |
926 | + |
927 | def _get_partial_state_file(filename): |
928 | """ |
929 | Read a partial state file from disk. |
930 | @@ -118,16 +119,16 @@ |
931 | return state |
932 | |
933 | partial_state_file_content = _get_partial_state_file( |
934 | - os.path.join(os.path.dirname(__file__), "..", "examples", |
935 | - "test_state_partial_inprogress.yaml") |
936 | + os.path.join(os.path.dirname(__file__), "..", "examples", |
937 | + "test_state_partial_inprogress.yaml") |
938 | ) |
939 | |
940 | partial_state_file_content_run_all = _get_partial_state_file( |
941 | - os.path.join(os.path.dirname(__file__), "..", "examples", |
942 | - "test_state_partial_run_all.yaml") |
943 | + os.path.join(os.path.dirname(__file__), "..", "examples", |
944 | + "test_state_partial_run_all.yaml") |
945 | ) |
946 | |
947 | partial_state_file_content_done_all_failed = _get_partial_state_file( |
948 | - os.path.join(os.path.dirname(__file__), "..", "examples", |
949 | - "test_state_partial_all_failed.yaml") |
950 | + os.path.join(os.path.dirname(__file__), "..", "examples", |
951 | + "test_state_partial_all_failed.yaml") |
952 | ) |
953 | |
954 | === modified file 'utah/client/tests/manual_privileges.py' |
955 | --- utah/client/tests/manual_privileges.py 2012-12-03 14:02:18 +0000 |
956 | +++ utah/client/tests/manual_privileges.py 2012-12-08 02:12:21 +0000 |
957 | @@ -87,7 +87,7 @@ |
958 | |
959 | def stat_file(filename=TMP_FILENAME): |
960 | proc = subprocess.Popen(['ls', '-al', filename], stdout=subprocess.PIPE, |
961 | - stderr=subprocess.PIPE) |
962 | + stderr=subprocess.PIPE) |
963 | |
964 | stdout, _stderr = proc.communicate() |
965 | print("{}: {}".format(filename, stdout)) |
966 | @@ -183,6 +183,6 @@ |
967 | 'euid': NOBODY_UID, |
968 | 'gid': NOGROUP_GID, |
969 | 'egid': NOGROUP_GID, |
970 | - }) |
971 | + }) |
972 | |
973 | _do_cmd("id") |
974 | |
975 | === modified file 'utah/client/tests/test_common.py' |
976 | --- utah/client/tests/test_common.py 2012-12-03 14:02:18 +0000 |
977 | +++ utah/client/tests/test_common.py 2012-12-08 02:12:21 +0000 |
978 | @@ -18,13 +18,13 @@ |
979 | |
980 | # REQUIRES that the top level utah package be in the Python path. |
981 | from utah.client.common import ( |
982 | - get_media_info, |
983 | - get_product_uuid, |
984 | - get_host_info, |
985 | - run_cmd, |
986 | - debug_print, |
987 | - CONFIG, |
988 | - ) |
989 | + get_media_info, |
990 | + get_product_uuid, |
991 | + get_host_info, |
992 | + run_cmd, |
993 | + debug_print, |
994 | + CONFIG, |
995 | +) |
996 | |
997 | |
998 | class TestCommon(unittest.TestCase): |
999 | |
1000 | === modified file 'utah/client/tests/test_jsonschema.py' |
1001 | --- utah/client/tests/test_jsonschema.py 2012-12-03 14:02:18 +0000 |
1002 | +++ utah/client/tests/test_jsonschema.py 2012-12-08 02:12:21 +0000 |
1003 | @@ -54,28 +54,28 @@ |
1004 | """ |
1005 | |
1006 | yaml_content_bad = [ |
1007 | -"""--- |
1008 | + """--- |
1009 | testsuties: |
1010 | - name: testsuite1 |
1011 | fetch_method: bzr |
1012 | fetch_location: lp:utah |
1013 | """, # typo |
1014 | -"""--- |
1015 | + """--- |
1016 | timeout: 101 |
1017 | repeat_count: 99 |
1018 | """, # missing testsuites |
1019 | -"""--- |
1020 | + """--- |
1021 | - name: blah |
1022 | - name: blip |
1023 | """, # missing fetch options |
1024 | -"""--- |
1025 | + """--- |
1026 | testsuites: |
1027 | - name: blah |
1028 | - name: blip |
1029 | """, # missing fetch options |
1030 | -"""--- |
1031 | + """--- |
1032 | testsuites: |
1033 | -""", # no testsuites |
1034 | +""", # no testsuites |
1035 | ] |
1036 | |
1037 | |
1038 | |
1039 | === modified file 'utah/client/tests/test_phoenix.py' |
1040 | --- utah/client/tests/test_phoenix.py 2012-12-03 14:02:18 +0000 |
1041 | +++ utah/client/tests/test_phoenix.py 2012-12-08 02:12:21 +0000 |
1042 | @@ -39,19 +39,19 @@ |
1043 | |
1044 | def setUp(self): |
1045 | self.phoenix = Phoenix( |
1046 | - self.testsuite_name, |
1047 | - directory=self.directory_name, |
1048 | - testcases=self.testcases, |
1049 | - ) |
1050 | + self.testsuite_name, |
1051 | + directory=self.directory_name, |
1052 | + testcases=self.testcases, |
1053 | + ) |
1054 | |
1055 | def test_missing_required_args(self): |
1056 | """ |
1057 | Test that __init__ fails without the required arguments |
1058 | """ |
1059 | self.assertRaises( |
1060 | - TypeError, |
1061 | - Phoenix, |
1062 | - ) |
1063 | + TypeError, |
1064 | + Phoenix, |
1065 | + ) |
1066 | |
1067 | def test_providing_required_args(self): |
1068 | """ |
1069 | @@ -109,13 +109,13 @@ |
1070 | tc_paths.append(os.path.join(ts_path, tc)) |
1071 | |
1072 | self.assertTrue(os.path.exists(dir_path), |
1073 | - "{} doesn't exist".format(dir_path)) |
1074 | + "{} doesn't exist".format(dir_path)) |
1075 | self.assertTrue(os.path.exists(ts_path), |
1076 | - "{} doesn't exist".format(ts_path)) |
1077 | + "{} doesn't exist".format(ts_path)) |
1078 | |
1079 | for path in tc_paths: |
1080 | self.assertTrue(os.path.exists(path), |
1081 | - "{} doesn't exist".format(path)) |
1082 | + "{} doesn't exist".format(path)) |
1083 | |
1084 | def test_create_file(self): |
1085 | """ |
1086 | |
1087 | === modified file 'utah/client/tests/test_result.py' |
1088 | --- utah/client/tests/test_result.py 2012-12-03 14:02:18 +0000 |
1089 | +++ utah/client/tests/test_result.py 2012-12-08 02:12:21 +0000 |
1090 | @@ -17,9 +17,9 @@ |
1091 | import yaml |
1092 | |
1093 | from utah.client.result import ( |
1094 | - Result, |
1095 | - ResultYAML, |
1096 | - ) |
1097 | + Result, |
1098 | + ResultYAML, |
1099 | +) |
1100 | |
1101 | |
1102 | class TestResult(unittest.TestCase): |
1103 | |
1104 | === modified file 'utah/client/tests/test_runner.py' |
1105 | --- utah/client/tests/test_runner.py 2012-12-03 14:02:18 +0000 |
1106 | +++ utah/client/tests/test_runner.py 2012-12-08 02:12:21 +0000 |
1107 | @@ -24,12 +24,13 @@ |
1108 | from utah.client.common import RETURN_CODES |
1109 | from utah.client import exceptions |
1110 | |
1111 | -from .common import ( # NOQA |
1112 | - setUp, # Used by nosetests |
1113 | - tearDown, # Used by nosetests |
1114 | - master_runlist_content, |
1115 | - get_module_path, |
1116 | - ) |
1117 | +from .common import ( |
1118 | + # NOQA |
1119 | + setUp, # Used by nosetests |
1120 | + tearDown, # Used by nosetests |
1121 | + master_runlist_content, |
1122 | + get_module_path, |
1123 | +) |
1124 | |
1125 | |
1126 | class TestRunner(unittest.TestCase): |
1127 | @@ -43,7 +44,7 @@ |
1128 | self.bad_dir = "/tmp/does_not_exist" |
1129 | |
1130 | self.assertFalse(os.path.exists(self.bad_dir), |
1131 | - "{} shouldn't exist".format(self.bad_dir)) |
1132 | + "{} shouldn't exist".format(self.bad_dir)) |
1133 | |
1134 | def tearDown(self): |
1135 | |
1136 | @@ -73,7 +74,7 @@ |
1137 | fp.close() |
1138 | |
1139 | runner = Runner(install_type='desktop', result_class=self.result_class, |
1140 | - state_agent=self.state_agent, runlist=runlist) |
1141 | + state_agent=self.state_agent, runlist=runlist) |
1142 | |
1143 | # remove the runlist as early as possible to avoid leaving it |
1144 | # laying around if this test fails. |
1145 | |
1146 | === modified file 'utah/client/tests/test_state_agent.py' |
1147 | --- utah/client/tests/test_state_agent.py 2012-12-06 16:30:34 +0000 |
1148 | +++ utah/client/tests/test_state_agent.py 2012-12-08 02:12:21 +0000 |
1149 | @@ -23,15 +23,15 @@ |
1150 | from utah.client.result import ResultYAML |
1151 | from utah.client.common import UTAH_DIR |
1152 | |
1153 | -from .common import ( # NOQA |
1154 | - setUp, # Used by nosetests |
1155 | - tearDown, # Used by nosetests |
1156 | - get_module_path, |
1157 | - partial_state_file_content, |
1158 | - partial_state_file_content_run_all, |
1159 | - partial_state_file_content_done_all_failed, |
1160 | - ) |
1161 | - |
1162 | +from .common import ( |
1163 | + # NOQA |
1164 | + setUp, # Used by nosetests |
1165 | + tearDown, # Used by nosetests |
1166 | + get_module_path, |
1167 | + partial_state_file_content, |
1168 | + partial_state_file_content_run_all, |
1169 | + partial_state_file_content_done_all_failed, |
1170 | +) |
1171 | |
1172 | |
1173 | class TestStateAgentYAML(unittest.TestCase): |
1174 | @@ -42,15 +42,19 @@ |
1175 | self.state_file = '/tmp/state.yaml' |
1176 | |
1177 | # Fail if there is already a test state file. |
1178 | - self.assertFalse(os.path.exists(self.state_file), |
1179 | - "state file (%s) already exists" % self.state_file) |
1180 | + self.assertFalse( |
1181 | + os.path.exists(self.state_file), |
1182 | + "state file (%s) already exists" % self.state_file) |
1183 | |
1184 | self.state_agent = StateAgentYAML(state_file=self.state_file) |
1185 | - self.runner = Runner(install_type="desktop", result_class=ResultYAML, |
1186 | - state_agent=self.state_agent) |
1187 | + self.runner = Runner( |
1188 | + install_type="desktop", result_class=ResultYAML, |
1189 | + state_agent=self.state_agent) |
1190 | self.partial_state_file_content = partial_state_file_content |
1191 | - self.partial_state_file_content_run_all = partial_state_file_content_run_all |
1192 | - self.partial_state_file_content_done_all_failed = partial_state_file_content_done_all_failed |
1193 | + self.partial_state_file_content_run_all = \ |
1194 | + partial_state_file_content_run_all |
1195 | + self.partial_state_file_content_done_all_failed = \ |
1196 | + partial_state_file_content_done_all_failed |
1197 | |
1198 | def tearDown(self): |
1199 | """ |
1200 | @@ -112,7 +116,7 @@ |
1201 | |
1202 | # Need to set up utah_tests since we're simulating a restart |
1203 | test_src = os.path.join(get_module_path(), 'client', |
1204 | - 'examples', 'utah_tests') |
1205 | + 'examples', 'utah_tests') |
1206 | test_dir = os.path.join(UTAH_DIR, 'testsuites', |
1207 | 'utah_tests', 'utah_tests') |
1208 | if not os.path.exists(test_dir): |
1209 | @@ -120,17 +124,18 @@ |
1210 | |
1211 | # Need to set up utah_tests_sample since we're simulating a restart |
1212 | test_src = os.path.join(get_module_path(), 'client', |
1213 | - 'examples', 'utah_tests_sample') |
1214 | - test_dir = os.path.join(UTAH_DIR, 'testsuites', 'utah_tests_sample', |
1215 | - 'utah_tests_sample') |
1216 | + 'examples', 'utah_tests_sample') |
1217 | + test_dir = os.path.join(UTAH_DIR, 'testsuites', |
1218 | + 'utah_tests_sample', 'utah_tests_sample') |
1219 | if not os.path.exists(test_dir): |
1220 | shutil.copytree(test_src, test_dir) |
1221 | |
1222 | state_agent = StateAgentYAML(state_file=self.state_file) |
1223 | - runner = Runner(install_type="desktop", |
1224 | - state_agent=state_agent, |
1225 | - result_class=ResultYAML, |
1226 | - resume=True) |
1227 | + runner = Runner( |
1228 | + install_type="desktop", |
1229 | + state_agent=state_agent, |
1230 | + result_class=ResultYAML, |
1231 | + resume=True) |
1232 | |
1233 | self.assertEqual(runner.status, 'RUN') |
1234 | self.assertEqual(runner.count_suites(), 3) |
1235 | @@ -157,7 +162,7 @@ |
1236 | |
1237 | # Need to set up utah_tests since we're simulating a restart |
1238 | test_src = os.path.join(get_module_path(), 'client', |
1239 | - 'examples', 'utah_tests') |
1240 | + 'examples', 'utah_tests') |
1241 | test_dir = os.path.join(UTAH_DIR, 'testsuites', |
1242 | 'utah_tests', 'utah_tests') |
1243 | if not os.path.exists(test_dir): |
1244 | @@ -165,17 +170,17 @@ |
1245 | |
1246 | # Need to set up utah_tests_sample since we're simulating a restart |
1247 | test_src = os.path.join(get_module_path(), 'client', |
1248 | - 'examples', 'utah_tests_sample') |
1249 | - test_dir = os.path.join(UTAH_DIR, 'testsuites', 'utah_tests_sample', |
1250 | - 'utah_tests_sample') |
1251 | + 'examples', 'utah_tests_sample') |
1252 | + test_dir = os.path.join(UTAH_DIR, 'testsuites', |
1253 | + 'utah_tests_sample', 'utah_tests_sample') |
1254 | if not os.path.exists(test_dir): |
1255 | shutil.copytree(test_src, test_dir) |
1256 | |
1257 | state_agent = StateAgentYAML(state_file=self.state_file) |
1258 | runner = Runner(install_type="desktop", |
1259 | - state_agent=state_agent, |
1260 | - result_class=ResultYAML, |
1261 | - resume=True) |
1262 | + state_agent=state_agent, |
1263 | + result_class=ResultYAML, |
1264 | + resume=True) |
1265 | |
1266 | self.assertEqual(runner.status, 'RUN') |
1267 | self.assertEqual(runner.count_suites(), 3) |
1268 | @@ -202,7 +207,7 @@ |
1269 | |
1270 | # Need to set up utah_tests since we're simulating a restart |
1271 | test_src = os.path.join(get_module_path(), 'client', |
1272 | - 'examples', 'utah_tests') |
1273 | + 'examples', 'utah_tests') |
1274 | test_dir = os.path.join(UTAH_DIR, 'testsuites', |
1275 | 'utah_tests', 'utah_tests') |
1276 | if not os.path.exists(test_dir): |
1277 | @@ -210,17 +215,17 @@ |
1278 | |
1279 | # Need to set up utah_tests_sample since we're simulating a restart |
1280 | test_src = os.path.join(get_module_path(), 'client', |
1281 | - 'examples', 'utah_tests_sample') |
1282 | - test_dir = os.path.join(UTAH_DIR, 'testsuites', 'utah_tests_sample', |
1283 | - 'utah_tests_sample') |
1284 | + 'examples', 'utah_tests_sample') |
1285 | + test_dir = os.path.join(UTAH_DIR, 'testsuites', |
1286 | + 'utah_tests_sample', 'utah_tests_sample') |
1287 | if not os.path.exists(test_dir): |
1288 | shutil.copytree(test_src, test_dir) |
1289 | |
1290 | state_agent = StateAgentYAML(state_file=self.state_file) |
1291 | runner = Runner(install_type="desktop", |
1292 | - state_agent=state_agent, |
1293 | - result_class=ResultYAML, |
1294 | - resume=True) |
1295 | + state_agent=state_agent, |
1296 | + result_class=ResultYAML, |
1297 | + resume=True) |
1298 | |
1299 | self.assertEqual(runner.status, 'RUN') |
1300 | self.assertEqual(runner.count_suites(), 3) |
1301 | |
1302 | === modified file 'utah/client/tests/test_testcase.py' |
1303 | --- utah/client/tests/test_testcase.py 2012-12-03 14:02:18 +0000 |
1304 | +++ utah/client/tests/test_testcase.py 2012-12-08 02:12:21 +0000 |
1305 | @@ -19,14 +19,15 @@ |
1306 | from utah.client.exceptions import MissingData |
1307 | from utah.client.result import ResultYAML |
1308 | from utah.client.common import ( |
1309 | - UTAH_DIR, |
1310 | - ) |
1311 | + UTAH_DIR, |
1312 | +) |
1313 | from utah.client import testcase |
1314 | |
1315 | -from .common import ( # NOQA |
1316 | - setUp, # Used by nosetests |
1317 | - tearDown, # Used by nosetests |
1318 | - ) |
1319 | +from .common import ( |
1320 | + # NOQA |
1321 | + setUp, # Used by nosetests |
1322 | + tearDown, # Used by nosetests |
1323 | +) |
1324 | |
1325 | |
1326 | class TestTestCase(unittest.TestCase): |
1327 | @@ -79,9 +80,9 @@ |
1328 | state = self.case.save_state() |
1329 | |
1330 | case = testcase.TestCase( |
1331 | - name=self.name, |
1332 | - path=self.path, |
1333 | - result=ResultYAML() |
1334 | + name=self.name, |
1335 | + path=self.path, |
1336 | + result=ResultYAML() |
1337 | ) |
1338 | case.load_state(state) |
1339 | |
1340 | @@ -99,10 +100,10 @@ |
1341 | def test_timeout_override(self): |
1342 | timeout = 99 |
1343 | case = testcase.TestCase( |
1344 | - name=self.name, |
1345 | - path=self.path, |
1346 | - timeout=timeout, |
1347 | - result=ResultYAML() |
1348 | + name=self.name, |
1349 | + path=self.path, |
1350 | + timeout=timeout, |
1351 | + result=ResultYAML() |
1352 | ) |
1353 | |
1354 | self.assertEqual(timeout, case.timeout) |
1355 | @@ -113,21 +114,21 @@ |
1356 | doesn't raise an exception. |
1357 | """ |
1358 | control_data = { |
1359 | - 'description': 'a test case', |
1360 | - 'command': '/bin/true', |
1361 | - 'dependencies': 'n/a', |
1362 | - 'action': 'n/a', |
1363 | - 'expected_results': 'n/a', |
1364 | - } |
1365 | + 'description': 'a test case', |
1366 | + 'command': '/bin/true', |
1367 | + 'dependencies': 'n/a', |
1368 | + 'action': 'n/a', |
1369 | + 'expected_results': 'n/a', |
1370 | + } |
1371 | |
1372 | result = ResultYAML() |
1373 | |
1374 | case = testcase.TestCase( |
1375 | - name=self.name, |
1376 | - path=self.path, |
1377 | - result=result, |
1378 | - _control_data=control_data, |
1379 | - ) |
1380 | + name=self.name, |
1381 | + path=self.path, |
1382 | + result=result, |
1383 | + _control_data=control_data, |
1384 | + ) |
1385 | |
1386 | case.run() |
1387 | print result |
1388 | @@ -141,18 +142,18 @@ |
1389 | does raise an exception. |
1390 | """ |
1391 | control_data = { |
1392 | - 'description': 'a test case', |
1393 | - 'command': '/bin/true', |
1394 | - } |
1395 | + 'description': 'a test case', |
1396 | + 'command': '/bin/true', |
1397 | + } |
1398 | |
1399 | result = ResultYAML() |
1400 | |
1401 | case = testcase.TestCase( |
1402 | - name=self.name, |
1403 | - path=self.path, |
1404 | - result=result, |
1405 | - _control_data=control_data, |
1406 | - ) |
1407 | + name=self.name, |
1408 | + path=self.path, |
1409 | + result=result, |
1410 | + _control_data=control_data, |
1411 | + ) |
1412 | |
1413 | with self.assertRaises(MissingData): |
1414 | case.run() |
1415 | |
1416 | === modified file 'utah/client/tests/test_testsuite.py' |
1417 | --- utah/client/tests/test_testsuite.py 2012-12-03 14:02:18 +0000 |
1418 | +++ utah/client/tests/test_testsuite.py 2012-12-08 02:12:21 +0000 |
1419 | @@ -17,15 +17,16 @@ |
1420 | import unittest |
1421 | |
1422 | from utah.client.common import ( |
1423 | - debug_print, |
1424 | - ) |
1425 | + debug_print, |
1426 | +) |
1427 | from utah.client.result import ResultYAML |
1428 | from utah.client import testsuite |
1429 | |
1430 | -from .common import ( # NOQA |
1431 | - setUp, # Used by nosetests |
1432 | - tearDown, # Used by nosetests |
1433 | - ) |
1434 | +from .common import ( |
1435 | + # NOQA |
1436 | + setUp, # Used by nosetests |
1437 | + tearDown, # Used by nosetests |
1438 | +) |
1439 | |
1440 | |
1441 | def state_saver(): |
1442 | @@ -81,11 +82,12 @@ |
1443 | def test_timeout_override(self): |
1444 | timeout = 101 |
1445 | suite = testsuite.TestSuite( |
1446 | - name=self.name, |
1447 | - path=self.path, |
1448 | - timeout=timeout, |
1449 | - result=ResultYAML(), |
1450 | - _save_state_callback=state_saver) |
1451 | + name=self.name, |
1452 | + path=self.path, |
1453 | + timeout=timeout, |
1454 | + result=ResultYAML(), |
1455 | + _save_state_callback=state_saver |
1456 | + ) |
1457 | |
1458 | self.assertEqual(timeout, suite.timeout) |
1459 | |
1460 | @@ -96,10 +98,12 @@ |
1461 | """Included tests are executed""" |
1462 | included_test_name = 'test_one' |
1463 | |
1464 | - suite = testsuite.TestSuite(name=self.name, |
1465 | - includes=[included_test_name], |
1466 | - path=self.path, |
1467 | - result=ResultYAML()) |
1468 | + suite = testsuite.TestSuite( |
1469 | + name=self.name, |
1470 | + includes=[included_test_name], |
1471 | + path=self.path, |
1472 | + result=ResultYAML() |
1473 | + ) |
1474 | |
1475 | # Make sure just one test case has been selected |
1476 | self.assertEqual(len(suite.tests), 1) |
1477 | @@ -112,10 +116,12 @@ |
1478 | """Excluded tests are *not* executed""" |
1479 | excluded_test_name = 'test_two' |
1480 | |
1481 | - suite = testsuite.TestSuite(name=self.name, |
1482 | - excludes=[excluded_test_name], |
1483 | - path=self.path, |
1484 | - result=ResultYAML()) |
1485 | + suite = testsuite.TestSuite( |
1486 | + name=self.name, |
1487 | + excludes=[excluded_test_name], |
1488 | + path=self.path, |
1489 | + result=ResultYAML() |
1490 | + ) |
1491 | |
1492 | # Make sure just one test case has been selected |
1493 | self.assertEqual(len(suite.tests), 1) |
1494 | @@ -129,11 +135,13 @@ |
1495 | included_test_name = 'test_one' |
1496 | excluded_test_name = 'test_two' |
1497 | |
1498 | - suite = testsuite.TestSuite(name=self.name, |
1499 | - includes=[included_test_name], |
1500 | - excludes=[excluded_test_name], |
1501 | - path=self.path, |
1502 | - result=ResultYAML()) |
1503 | + suite = testsuite.TestSuite( |
1504 | + name=self.name, |
1505 | + includes=[included_test_name], |
1506 | + excludes=[excluded_test_name], |
1507 | + path=self.path, |
1508 | + result=ResultYAML() |
1509 | + ) |
1510 | |
1511 | # Make sure just one test case has been selected |
1512 | self.assertEqual(len(suite.tests), 1) |
1513 | |
1514 | === modified file 'utah/client/tests/test_yaml.py' |
1515 | --- utah/client/tests/test_yaml.py 2012-12-03 14:02:18 +0000 |
1516 | +++ utah/client/tests/test_yaml.py 2012-12-08 02:12:21 +0000 |
1517 | @@ -21,15 +21,15 @@ |
1518 | def test_parts(self): |
1519 | content = {} |
1520 | content['metadata'] = { |
1521 | - 'runlist': '/tmp/master.run', |
1522 | - 'host': 'Ubuntu 12.04 LTS', |
1523 | + 'runlist': '/tmp/master.run', |
1524 | + 'host': 'Ubuntu 12.04 LTS', |
1525 | } |
1526 | content['commands'] = [ |
1527 | - { |
1528 | - 'command': 'rm -f blah', |
1529 | - 'stdout': '', |
1530 | - 'stderr': '', |
1531 | - } |
1532 | + { |
1533 | + 'command': 'rm -f blah', |
1534 | + 'stdout': '', |
1535 | + 'stderr': '', |
1536 | + } |
1537 | ] |
1538 | |
1539 | enc_data = yaml.dump(content, default_flow_style=False) |
1540 | @@ -42,28 +42,28 @@ |
1541 | |
1542 | def test_parts_2(self): |
1543 | content = { |
1544 | - 'file': '/tmp/file' |
1545 | - } |
1546 | + 'file': '/tmp/file' |
1547 | + } |
1548 | |
1549 | extra_args = { |
1550 | - #'explicit_start': '---', |
1551 | - #'explicit_end': '...', |
1552 | - } |
1553 | + #'explicit_start': '---', |
1554 | + #'explicit_end': '...', |
1555 | + } |
1556 | |
1557 | enc_data = yaml.dump(content, default_flow_style=False, **extra_args) |
1558 | |
1559 | content = { |
1560 | - 'commands': |
1561 | - [ |
1562 | - { |
1563 | - 'size': 100, |
1564 | - 'perms': 'rwxr-xr-x', |
1565 | - }, |
1566 | - { |
1567 | - 'size': 120, |
1568 | - 'perms': 'rwxr-xr-x', |
1569 | - }, |
1570 | - ] |
1571 | + 'commands': |
1572 | + [ |
1573 | + { |
1574 | + 'size': 100, |
1575 | + 'perms': 'rwxr-xr-x', |
1576 | + }, |
1577 | + { |
1578 | + 'size': 120, |
1579 | + 'perms': 'rwxr-xr-x', |
1580 | + }, |
1581 | + ] |
1582 | } |
1583 | |
1584 | enc_data += yaml.dump(content, default_flow_style=False, **extra_args) |
1585 | @@ -78,19 +78,19 @@ |
1586 | def test_parts_3(self): |
1587 | extra_args = {} |
1588 | content = [ |
1589 | - { |
1590 | - 'file': '/tmp/file', |
1591 | - }, |
1592 | - [ |
1593 | - { |
1594 | - 'size': 100, |
1595 | - 'perms': 'rwxr-xr-x', |
1596 | - }, |
1597 | - { |
1598 | - 'size': 120, |
1599 | - 'perms': 'rwxr-xr-x', |
1600 | - }, |
1601 | - ] |
1602 | + { |
1603 | + 'file': '/tmp/file', |
1604 | + }, |
1605 | + [ |
1606 | + { |
1607 | + 'size': 100, |
1608 | + 'perms': 'rwxr-xr-x', |
1609 | + }, |
1610 | + { |
1611 | + 'size': 120, |
1612 | + 'perms': 'rwxr-xr-x', |
1613 | + }, |
1614 | + ] |
1615 | ] |
1616 | enc_data = yaml.dump(content, default_flow_style=False, **extra_args) |
1617 | print(enc_data) |
1618 | |
1619 | === modified file 'utah/client/testsuite.py' |
1620 | --- utah/client/testsuite.py 2012-12-06 16:30:34 +0000 |
1621 | +++ utah/client/testsuite.py 2012-12-08 02:12:21 +0000 |
1622 | @@ -64,11 +64,11 @@ |
1623 | 'test': { |
1624 | 'type': 'string', |
1625 | 'required': True, |
1626 | - }, |
1627 | - 'overrides': {'type': 'object'}, |
1628 | }, |
1629 | + 'overrides': {'type': 'object'}, |
1630 | }, |
1631 | - } |
1632 | + }, |
1633 | + } |
1634 | |
1635 | CONTROL_SCHEMA = { |
1636 | 'type': 'object', |
1637 | @@ -77,8 +77,8 @@ |
1638 | 'timeout': {'type': 'integer'}, |
1639 | 'ts_setup': {'type': 'string'}, |
1640 | 'ts_cleanup': {'type': 'string'}, |
1641 | - } |
1642 | } |
1643 | + } |
1644 | |
1645 | def __init__(self, name, path, result, runlist_file=DEFAULT_TSLIST, |
1646 | control_file=DEFAULT_TSCONTROL, includes=None, excludes=None, |
1647 | @@ -128,9 +128,9 @@ |
1648 | control_data = None |
1649 | except jsonschema.ValidationError as exception: |
1650 | raise ValidationError( |
1651 | - '{!r} test suite control file invalid: {!r}\n' |
1652 | - 'Detailed information: {}' |
1653 | - .format(self.name, self.control_file, exception)) |
1654 | + '{!r} test suite control file invalid: {!r}\n1' |
1655 | + 'Detailed information: {}' |
1656 | + .format(self.name, self.control_file, exception)) |
1657 | |
1658 | if control_data is not None: |
1659 | # already initialized |
1660 | @@ -146,9 +146,9 @@ |
1661 | runlist_data = parse_runlist_file(self.runlist_file) |
1662 | except jsonschema.ValidationError as exception: |
1663 | raise ValidationError( |
1664 | - '{!r} test suite runlist invalid: {!r}\n' |
1665 | - 'Detailed information: {}' |
1666 | - .format(self.name, self.runlist_file, exception)) |
1667 | + '{!r} test suite runlist invalid: {!r}\n' |
1668 | + 'Detailed information: {}' |
1669 | + .format(self.name, self.runlist_file, exception)) |
1670 | else: |
1671 | raise MissingFile('File not found: {}'.format(self.runlist_file)) |
1672 | |
1673 | |
1674 | === modified file 'utah/config.py' |
1675 | --- utah/config.py 2012-12-03 15:49:35 +0000 |
1676 | +++ utah/config.py 2012-12-08 02:12:21 +0000 |
1677 | @@ -113,14 +113,15 @@ |
1678 | # Default setting for configuration rewriting |
1679 | rewrite='all', |
1680 | # Available releases |
1681 | - serieschoices=[ # Remember to update uqt-vm-tools.conf as well |
1682 | - 'hardy', |
1683 | - 'lucid', |
1684 | - 'oneiric', |
1685 | - 'precise', |
1686 | - 'quantal', |
1687 | - 'raring', |
1688 | - ], |
1689 | + serieschoices=[ |
1690 | + # Remember to update uqt-vm-tools.conf as well |
1691 | + 'hardy', |
1692 | + 'lucid', |
1693 | + 'oneiric', |
1694 | + 'precise', |
1695 | + 'quantal', |
1696 | + 'raring', |
1697 | + ], |
1698 | # Default machine template |
1699 | template=None, |
1700 | # Directory to hold web-accessible files |
1701 | @@ -155,8 +156,9 @@ |
1702 | LOCALDEFAULTS['hostname'] + '.log') |
1703 | # Default logfile is /var/log/utah/{hostname}-debug.log |
1704 | # Set to None to disable separate debug log |
1705 | -LOCALDEFAULTS['debuglog'] = os.path.join(DEFAULTS['logpath'], |
1706 | - LOCALDEFAULTS['hostname'] + '-debug.log') |
1707 | +LOCALDEFAULTS['debuglog'] = os.path.join( |
1708 | + DEFAULTS['logpath'], |
1709 | + LOCALDEFAULTS['hostname'] + '-debug.log') |
1710 | |
1711 | # This depends on a binary that may not be installed. |
1712 | # Also, the null thing may seem obvious, but I found it here: |
1713 | @@ -167,18 +169,18 @@ |
1714 | stdout=fnull, stderr=fnull) == 0: |
1715 | # If dpkg-architecture is available, default to current host arch |
1716 | LOCALDEFAULTS['arch'] = subprocess.check_output( |
1717 | - ['dpkg-architecture', '-qDEB_HOST_ARCH']).strip() |
1718 | + ['dpkg-architecture', '-qDEB_HOST_ARCH']).strip() |
1719 | else: |
1720 | # Otherwise, default to i386 |
1721 | LOCALDEFAULTS['arch'] = 'i386' |
1722 | - |
1723 | + |
1724 | # I'm not sure lsb_release is always around |
1725 | with open(os.devnull, 'w') as fnull: |
1726 | if subprocess.call(['which', 'lsb_release'], |
1727 | stdout=fnull, stderr=fnull) == 0: |
1728 | # If lsb_release is available, default to current series |
1729 | LOCALDEFAULTS['series'] = subprocess.check_output( |
1730 | - ['lsb_release', '-sc']).strip() |
1731 | + ['lsb_release', '-sc']).strip() |
1732 | else: |
1733 | # Otherwise, default to precise |
1734 | LOCALDEFAULTS['series'] = 'precise' |
1735 | |
1736 | === modified file 'utah/iso.py' |
1737 | --- utah/iso.py 2012-12-07 11:10:30 +0000 |
1738 | +++ utah/iso.py 2012-12-08 02:12:21 +0000 |
1739 | @@ -108,7 +108,7 @@ |
1740 | if config.debuglog is not None: |
1741 | self.logger.setLevel(logging.DEBUG) |
1742 | self.debughandler = ( |
1743 | - logging.handlers.WatchedFileHandler(config.debuglog)) |
1744 | + logging.handlers.WatchedFileHandler(config.debuglog)) |
1745 | self.debughandler.setFormatter(file_formatter) |
1746 | self.debughandler.setLevel(logging.DEBUG) |
1747 | self.logger.addHandler(self.debughandler) |
1748 | @@ -242,7 +242,7 @@ |
1749 | if '-O' in cmd: |
1750 | cmd.remove('-O') |
1751 | return subprocess.Popen(cmd, stdout=subprocess.PIPE, |
1752 | - stderr=subprocess.PIPE, **kw).communicate() |
1753 | + stderr=subprocess.PIPE, **kw).communicate() |
1754 | else: |
1755 | cmd = self.getrealfile(filename) |
1756 | return subprocess.call(cmd, stdout=open(outfile, 'w'), **kw) |
1757 | @@ -325,8 +325,8 @@ |
1758 | # Set the path to our files and the name of the iso we want |
1759 | if installtype == 'mini': |
1760 | remotepath = ('http://archive.ubuntu.com/ubuntu/dists/' |
1761 | - '{series}/main/installer-{arch}/current/' |
1762 | - 'images/'.format(arch=arch, series=series)) |
1763 | + '{series}/main/installer-{arch}/current/' |
1764 | + 'images/'.format(arch=arch, series=series)) |
1765 | isopattern = 'netboot/mini.iso' |
1766 | else: |
1767 | remotepath = ('http://releases.ubuntu.com/' |
1768 | |
1769 | === modified file 'utah/isotest/iso_static_validation.py' |
1770 | --- utah/isotest/iso_static_validation.py 2012-12-06 16:30:34 +0000 |
1771 | +++ utah/isotest/iso_static_validation.py 2012-12-08 02:12:21 +0000 |
1772 | @@ -204,7 +204,7 @@ |
1773 | |
1774 | # Test if the manfest is the same as that is given in the server |
1775 | @unittest.skipUnless(ubiquity_image, |
1776 | - "manifest only for ubiquity based images") |
1777 | + "manifest only for ubiquity based images") |
1778 | def test_manifest(self): |
1779 | manifest_url = os.path.join(self.url, 'current', |
1780 | self.st_release + '-' + |
1781 | @@ -304,7 +304,7 @@ |
1782 | |
1783 | # Test if the relevant important files are present in the iso for dvd iso |
1784 | @unittest.skipUnless(st_variant == 'dvd', |
1785 | - "This file list test is only specific for dvd") |
1786 | + "This file list test is only specific for dvd") |
1787 | def test_files_ubiquity_dvd(self): |
1788 | (stdout, stderr) = self.iso.listfiles() |
1789 | logging.debug('Check for error in extracting file list from the iso') |
1790 | |
1791 | === modified file 'utah/orderedcollections.py' |
1792 | --- utah/orderedcollections.py 2012-12-03 14:02:18 +0000 |
1793 | +++ utah/orderedcollections.py 2012-12-08 02:12:21 +0000 |
1794 | @@ -26,7 +26,7 @@ |
1795 | class OrderedSet(collections.MutableSet): |
1796 | |
1797 | def __init__(self, iterable=None): |
1798 | - self.end = end = [] |
1799 | + self.end = end = [] |
1800 | end += [None, end, end] # sentinel node for doubly linked list |
1801 | self.map = {} # key --> [key, prev, next] |
1802 | if iterable is not None: |
1803 | @@ -45,7 +45,7 @@ |
1804 | curr[NEXT] = end[PREV] = self.map[key] = [key, curr, end] |
1805 | |
1806 | def discard(self, key): |
1807 | - if key in self.map: |
1808 | + if key in self.map: |
1809 | key, prev, next = self.map.pop(key) |
1810 | prev[NEXT] = next |
1811 | next[PREV] = prev |
1812 | |
1813 | === modified file 'utah/process.py' |
1814 | --- utah/process.py 2012-12-03 14:02:18 +0000 |
1815 | +++ utah/process.py 2012-12-08 02:12:21 +0000 |
1816 | @@ -23,11 +23,11 @@ |
1817 | """ |
1818 | Check all running process looking for a given pattern |
1819 | """ |
1820 | - MESSAGE_TEMPLATE = \ |
1821 | - ("{app} application is running.\n" |
1822 | - "Please stop it before launching utah since " |
1823 | - "it won't interact properly with KVM " |
1824 | - "(Kernel-based Virtual Machine)\n") |
1825 | + MESSAGE_TEMPLATE = ( |
1826 | + "{app} application is running.\n" |
1827 | + "Please stop it before launching utah since " |
1828 | + "it won't interact properly with KVM " |
1829 | + "(Kernel-based Virtual Machine)\n") |
1830 | |
1831 | def check_cmdline(self, pattern): |
1832 | """ |
1833 | |
1834 | === modified file 'utah/provisioning/baremetal/bamboofeeder.py' |
1835 | --- utah/provisioning/baremetal/bamboofeeder.py 2012-12-06 16:30:34 +0000 |
1836 | +++ utah/provisioning/baremetal/bamboofeeder.py 2012-12-08 02:12:21 +0000 |
1837 | @@ -26,10 +26,10 @@ |
1838 | |
1839 | from utah import config |
1840 | from utah.provisioning.provisioning import ( |
1841 | - CustomInstallMixin, |
1842 | - Machine, |
1843 | - SSHMixin, |
1844 | - ) |
1845 | + CustomInstallMixin, |
1846 | + Machine, |
1847 | + SSHMixin, |
1848 | +) |
1849 | from utah.provisioning.baremetal.power import PowerMixin |
1850 | from utah.provisioning.baremetal.exceptions import UTAHBMProvisioningException |
1851 | from utah.retry import retry |
1852 | @@ -45,7 +45,7 @@ |
1853 | # TODO: respect rewrite setting |
1854 | if name is None: |
1855 | raise UTAHBMProvisioningException( |
1856 | - 'Machine name reqired for bamboo-feeder machine') |
1857 | + 'Machine name reqired for bamboo-feeder machine') |
1858 | if powercmd is not None: |
1859 | self.powercmd = powercmd |
1860 | elif cargs is not None: |
1861 | @@ -55,12 +55,12 @@ |
1862 | self.power[item] = cargs[item] |
1863 | else: |
1864 | raise UTAHBMProvisioningException( |
1865 | - 'No power control information specified') |
1866 | + 'No power control information specified') |
1867 | try: |
1868 | self.macaddress = cargs['mac-address'] |
1869 | except AttributeError: |
1870 | raise UTAHBMProvisioningException( |
1871 | - 'No MAC address specified') |
1872 | + 'No MAC address specified') |
1873 | self.inventory = inventory |
1874 | super(BambooFeederMachine, self).__init__(*args, name=name, **kw) |
1875 | if self.inventory is not None: |
1876 | @@ -68,7 +68,7 @@ |
1877 | self._depcheck() |
1878 | if self.image is None: |
1879 | raise UTAHBMProvisioningException( |
1880 | - 'Image file required for bamboo-feeder installation') |
1881 | + 'Image file required for bamboo-feeder installation') |
1882 | try: |
1883 | iface = config.wwwiface |
1884 | except AttributeError: |
1885 | @@ -108,9 +108,10 @@ |
1886 | self.imagedir = os.path.join(self.tmpdir, 'image.d') |
1887 | if not os.path.isdir(self.imagedir): |
1888 | os.makedirs(self.imagedir) |
1889 | - self.sector = int(subprocess.check_output(['file', |
1890 | - self.wwwimage] |
1891 | - ).strip().split(';')[1].split(',')[3].split()[1]) |
1892 | + self.sector = int( |
1893 | + subprocess.check_output( |
1894 | + ['file', self.wwwimage] |
1895 | + ).strip().split(';')[1].split(',')[3].split()[1]) |
1896 | self.logger.debug('Image start sector is ' + str(self.sector)) |
1897 | self.cleanfunction(self._umountimage) |
1898 | self.logger.debug('Mounting ' + self.wwwimage + ' at ' + |
1899 | @@ -167,15 +168,15 @@ |
1900 | pipe.copy('/dev/null', initrd) |
1901 | self.logger.debug('Creating uInitrd with mkimage') |
1902 | self._runargs(['mkimage', |
1903 | - '-A', 'arm', |
1904 | - '-O', 'linux', |
1905 | - '-T', 'ramdisk', |
1906 | - '-C', 'gzip', |
1907 | - '-a', '0', |
1908 | - '-e', '0', |
1909 | - '-n', 'initramfs', |
1910 | - '-d', initrd, |
1911 | - self.initrd]) |
1912 | + '-A', 'arm', |
1913 | + '-O', 'linux', |
1914 | + '-T', 'ramdisk', |
1915 | + '-C', 'gzip', |
1916 | + '-a', '0', |
1917 | + '-e', '0', |
1918 | + '-n', 'initramfs', |
1919 | + '-d', initrd, |
1920 | + self.initrd]) |
1921 | |
1922 | def _umountimage(self): |
1923 | """ |
1924 | @@ -206,8 +207,7 @@ |
1925 | ('log_port', '10514'), |
1926 | ('netcfg/choose_interface', 'auto'), |
1927 | ('url', 'http://' + self.ip + '/utah/' + self.name + |
1928 | - '.cfg'), |
1929 | - ): |
1930 | + '.cfg')): |
1931 | if parameter[0] not in self.cmdline: |
1932 | self.logger.info('Adding boot option: ' + '='.join(parameter)) |
1933 | self.cmdline += ' ' + '='.join(parameter) |
1934 | @@ -234,7 +234,7 @@ |
1935 | open(tmppxefile, 'w').write(pxeconfig) |
1936 | self.logger.debug('PXE info written to ' + tmppxefile) |
1937 | pxefile = os.path.join(config.pxedir, |
1938 | - '01-' + self.macaddress.replace(':', '-')) |
1939 | + '01-' + self.macaddress.replace(':', '-')) |
1940 | self.cleancommand(('sudo', 'rm', '-f', pxefile)) |
1941 | self.logger.debug('Copying ' + tmppxefile + ' to ' + pxefile) |
1942 | self._runargs(['sudo', 'cp', tmppxefile, pxefile]) |
1943 | @@ -270,8 +270,7 @@ |
1944 | self.logger.info('Configuring latecommand for desktop') |
1945 | myfile = open(os.path.join(self.tmpdir, 'initrd.d', |
1946 | 'utah-latecommand'), 'a') |
1947 | - myfile.write( |
1948 | -""" |
1949 | + myfile.write(""" |
1950 | chroot /target sh -c 'sed "/eth[0-9]/d" -i /etc/network/interfaces' |
1951 | """) |
1952 | myfile.close() |
1953 | @@ -300,12 +299,13 @@ |
1954 | if self.run(uuid_check_command)[0] != 0: |
1955 | self.provisioned = False |
1956 | raise UTAHBMProvisioningException( |
1957 | - 'Installed UUID differs from Machine UUID; ' |
1958 | - 'installation probably failed. ' |
1959 | - 'Try restarting cobbler or running cobbler sync') |
1960 | + 'Installed UUID differs from Machine UUID; ' |
1961 | + 'installation probably failed. ' |
1962 | + 'Try restarting cobbler or running cobbler sync') |
1963 | self.logger.info('System installed') |
1964 | - self.cleanfunction(self.run, ('dd', 'bs=512k', 'count=10', |
1965 | - 'if=/dev/zero', 'of=/dev/mmcblk0'), root=True) |
1966 | + self.cleanfunction(self.run, ( |
1967 | + 'dd', 'bs=512k', 'count=10', 'if=/dev/zero', 'of=/dev/mmcblk0'), |
1968 | + root=True) |
1969 | return True |
1970 | |
1971 | def _depcheck(self): |
1972 | |
1973 | === modified file 'utah/provisioning/baremetal/cobbler.py' |
1974 | --- utah/provisioning/baremetal/cobbler.py 2012-12-06 16:30:34 +0000 |
1975 | +++ utah/provisioning/baremetal/cobbler.py 2012-12-08 02:12:21 +0000 |
1976 | @@ -26,10 +26,10 @@ |
1977 | |
1978 | from utah import config |
1979 | from utah.provisioning.provisioning import ( |
1980 | - CustomInstallMixin, |
1981 | - Machine, |
1982 | - SSHMixin, |
1983 | - ) |
1984 | + CustomInstallMixin, |
1985 | + Machine, |
1986 | + SSHMixin, |
1987 | +) |
1988 | from utah.provisioning.baremetal.exceptions import UTAHBMProvisioningException |
1989 | from utah.provisioning.baremetal.power import PowerMixin |
1990 | from utah.retry import retry |
1991 | @@ -44,10 +44,10 @@ |
1992 | *args, **kw): |
1993 | if name is None: |
1994 | raise UTAHBMProvisioningException( |
1995 | - 'Machine name reqired for cobbler machine') |
1996 | + 'Machine name reqired for cobbler machine') |
1997 | if cargs is None: |
1998 | raise UTAHBMProvisioningException( |
1999 | - 'No cobbler arguments given for machine creation') |
2000 | + 'No cobbler arguments given for machine creation') |
2001 | else: |
2002 | self.cargs = cargs |
2003 | self.power = {} |
2004 | @@ -61,7 +61,7 @@ |
2005 | preseed=preseed, **kw) |
2006 | if self.image is None: |
2007 | raise UTAHBMProvisioningException( |
2008 | - 'Image file required for cobbler installation') |
2009 | + 'Image file required for cobbler installation') |
2010 | self._custominit() |
2011 | # TODO: verify we have nfs support for desktop image |
2012 | |
2013 | @@ -106,8 +106,7 @@ |
2014 | self.logger.info('Configuring latecommand for desktop') |
2015 | myfile = open(os.path.join(self.tmpdir, 'initrd.d', |
2016 | 'utah-latecommand'), 'a') |
2017 | - myfile.write( |
2018 | -""" |
2019 | + myfile.write(""" |
2020 | chroot /target sh -c 'sed "/eth[0-9]/d" -i /etc/network/interfaces' |
2021 | """) |
2022 | myfile.close() |
2023 | @@ -152,7 +151,7 @@ |
2024 | pipe.append('sudo tee -a ' + str(config.nfsconfigfile) + |
2025 | ' >/dev/null', '-.') |
2026 | pipe.open('/dev/null', 'w').write(self.tmpdir + ' ' + |
2027 | - config.nfsoptions + "\n") |
2028 | + config.nfsoptions + "\n") |
2029 | self.logger.debug('Reloading NFS config') |
2030 | self._runargs(config.nfscommand) |
2031 | self.logger.debug('Adding NFS boot options') |
2032 | @@ -176,8 +175,8 @@ |
2033 | self.logger.info('Adding system') |
2034 | self._cobble(['system', 'add', '--name=' + self.name, |
2035 | '--profile=' + self.cname, '--netboot-enabled=Y'] |
2036 | - + ['--' + arg + '=' + self.cargs[arg] |
2037 | - for arg in self.cargs]) |
2038 | + + ['--' + arg + '=' + self.cargs[arg] |
2039 | + for arg in self.cargs]) |
2040 | |
2041 | # Things seem to be working fine without this, |
2042 | # but sometimes things still get broken |
2043 | @@ -219,9 +218,9 @@ |
2044 | if self.run(uuid_check_command)[0] != 0: |
2045 | self.provisioned = False |
2046 | raise UTAHBMProvisioningException( |
2047 | - 'Installed UUID differs from CobblerMachine UUID; ' |
2048 | - 'installation probably failed. ' |
2049 | - 'Try restarting cobbler or running cobbler sync') |
2050 | + 'Installed UUID differs from CobblerMachine UUID; ' |
2051 | + 'installation probably failed. ' |
2052 | + 'Try restarting cobbler or running cobbler sync') |
2053 | self.logger.info('System installed') |
2054 | return True |
2055 | |
2056 | |
2057 | === modified file 'utah/provisioning/baremetal/power.py' |
2058 | --- utah/provisioning/baremetal/power.py 2012-12-03 14:02:18 +0000 |
2059 | +++ utah/provisioning/baremetal/power.py 2012-12-08 02:12:21 +0000 |
2060 | @@ -72,4 +72,3 @@ |
2061 | self.logger.debug('Waiting ' + str(config.powertimeout) + ' seconds') |
2062 | time.sleep(config.powertimeout) |
2063 | self._start() |
2064 | - |
2065 | |
2066 | === modified file 'utah/provisioning/inventory/inventory.py' |
2067 | --- utah/provisioning/inventory/inventory.py 2012-12-03 15:49:35 +0000 |
2068 | +++ utah/provisioning/inventory/inventory.py 2012-12-08 02:12:21 +0000 |
2069 | @@ -17,7 +17,7 @@ |
2070 | |
2071 | import os |
2072 | from utah.provisioning.inventory.exceptions import \ |
2073 | - UTAHProvisioningInventoryException |
2074 | + UTAHProvisioningInventoryException |
2075 | |
2076 | |
2077 | class Inventory(object): |
2078 | @@ -50,9 +50,9 @@ |
2079 | lockfile.close() |
2080 | if inventory != userinventory: |
2081 | raise UTAHProvisioningInventoryException( |
2082 | - 'Different inventory in use: ' + userinventory |
2083 | - + "\nDelete " + self.lockfile |
2084 | - + ' if you are sure it is no longer valid') |
2085 | + 'Different inventory in use: ' + userinventory |
2086 | + + "\nDelete " + self.lockfile |
2087 | + + ' if you are sure it is no longer valid') |
2088 | else: |
2089 | lockfile = open(self.lockfile, 'w') |
2090 | lockfile.write(inventory) |
2091 | @@ -91,7 +91,7 @@ |
2092 | send all arguments to that constructor. |
2093 | """ |
2094 | raise UTAHProvisioningInventoryException( |
2095 | - 'Method not defined for this inventory') |
2096 | + 'Method not defined for this inventory') |
2097 | |
2098 | def release(self): |
2099 | """ |
2100 | |
2101 | === modified file 'utah/provisioning/inventory/sqlite.py' |
2102 | --- utah/provisioning/inventory/sqlite.py 2012-12-03 15:49:35 +0000 |
2103 | +++ utah/provisioning/inventory/sqlite.py 2012-12-08 02:12:21 +0000 |
2104 | @@ -19,7 +19,7 @@ |
2105 | import os |
2106 | import psutil |
2107 | from utah.provisioning.inventory.exceptions import \ |
2108 | - UTAHProvisioningInventoryException |
2109 | + UTAHProvisioningInventoryException |
2110 | from utah.provisioning.inventory.inventory import Inventory |
2111 | from utah.provisioning.vm.libvirtvm import CustomVM |
2112 | from utah.provisioning.baremetal.cobbler import CobblerMachine |
2113 | @@ -55,8 +55,8 @@ |
2114 | """ |
2115 | super(TinySQLiteInventory, self).__init__(*args, **kw) |
2116 | self.connection.execute( |
2117 | - 'CREATE TABLE IF NOT EXISTS ' |
2118 | - 'machines(machineid INTEGER PRIMARY KEY, state TEXT)') |
2119 | + 'CREATE TABLE IF NOT EXISTS ' |
2120 | + 'machines(machineid INTEGER PRIMARY KEY, state TEXT)') |
2121 | |
2122 | def request(self, machinetype=CustomVM, *args, **kw): |
2123 | """ |
2124 | @@ -106,9 +106,10 @@ |
2125 | lockfile = os.path.expanduser(lockfile) |
2126 | if not os.path.isfile(db): |
2127 | raise UTAHProvisioningInventoryException( |
2128 | - 'No machine database found at ' + db) |
2129 | + 'No machine database found at ' + db) |
2130 | super(ManualCobblerSQLiteInventory, self).__init__(*args, db=db, |
2131 | - lockfile=lockfile, **kw) |
2132 | + lockfile=lockfile, |
2133 | + **kw) |
2134 | machines_count = (self.connection |
2135 | .execute('SELECT COUNT(*) FROM machines') |
2136 | .fetchall()[0][0]) |
2137 | @@ -125,7 +126,7 @@ |
2138 | result = self.connection.execute(query, queryvars).fetchall() |
2139 | if result is None: |
2140 | raise UTAHProvisioningInventoryException( |
2141 | - 'No machines meet criteria') |
2142 | + 'No machines meet criteria') |
2143 | else: |
2144 | for machineinfo in result: |
2145 | cargs = dict(machineinfo) |
2146 | @@ -135,16 +136,16 @@ |
2147 | cargs = dict(machineinfo) |
2148 | pid = cargs['pid'] |
2149 | try: |
2150 | - if not (psutil.pid_exists(pid) and ('utah' in |
2151 | + if not (psutil.pid_exists(pid) and ('utah' in |
2152 | ' '.join(psutil.Process(pid).cmdline) |
2153 | - or 'run_test_cobbler.py' in |
2154 | + or 'run_test_cobbler.py' in |
2155 | ' '.join(psutil.Process(pid).cmdline))): |
2156 | return self._take(cargs, *args, **kw) |
2157 | except ValueError: |
2158 | continue |
2159 | |
2160 | raise UTAHProvisioningInventoryException( |
2161 | - 'All machines meeting criteria are currently unavailable') |
2162 | + 'All machines meeting criteria are currently unavailable') |
2163 | |
2164 | def _take(self, cargs, *args, **kw): |
2165 | machineid = cargs.pop('machineid') |
2166 | @@ -152,33 +153,34 @@ |
2167 | state = cargs.pop('state') |
2168 | pid = cargs.pop('pid') |
2169 | update = self.connection.execute( |
2170 | - "UPDATE machines SET pid=?, state='provisioned' WHERE machineid=? AND state=?", |
2171 | - [os.getpid(), machineid, state]).rowcount |
2172 | + "UPDATE machines SET pid=?, state='provisioned' WHERE machineid=?" |
2173 | + "AND state=?", |
2174 | + [os.getpid(), machineid, state]).rowcount |
2175 | if update == 1: |
2176 | machine = CobblerMachine(*args, cargs=cargs, |
2177 | - inventory=self, name=name, **kw) |
2178 | + inventory=self, name=name, **kw) |
2179 | self.machines.append(machine) |
2180 | return machine |
2181 | elif update == 0: |
2182 | raise UTAHProvisioningInventoryException( |
2183 | - 'Machine was requested by another process ' |
2184 | - 'before we could request it') |
2185 | + 'Machine was requested by another process ' |
2186 | + 'before we could request it') |
2187 | elif update > 1: |
2188 | raise UTAHProvisioningInventoryException( |
2189 | - 'Multiple machines exist ' |
2190 | - 'matching those criteria; ' |
2191 | - 'database ' + self.db + ' may be corrupt') |
2192 | + 'Multiple machines exist ' |
2193 | + 'matching those criteria; ' |
2194 | + 'database ' + self.db + ' may be corrupt') |
2195 | else: |
2196 | raise UTAHProvisioningInventoryException( |
2197 | - 'Negative rowcount returned ' |
2198 | - 'when attempting to request machine') |
2199 | + 'Negative rowcount returned ' |
2200 | + 'when attempting to request machine') |
2201 | |
2202 | def release(self, machine=None, name=None): |
2203 | if machine is not None: |
2204 | name = machine.name |
2205 | if name is None: |
2206 | raise UTAHProvisioningInventoryException( |
2207 | - 'name required to release a machine') |
2208 | + 'name required to release a machine') |
2209 | query = "UPDATE machines SET state='available' WHERE name=?" |
2210 | queryvars = [name] |
2211 | update = self.connection.execute(query, queryvars).rowcount |
2212 | @@ -188,17 +190,17 @@ |
2213 | self.machines.remove(machine) |
2214 | elif update == 0: |
2215 | raise UTAHProvisioningInventoryException( |
2216 | - 'SERIOUS ERROR: Another process released this machine ' |
2217 | - 'before we could, which means two processes provisioned ' |
2218 | - 'the same machine simultaneously') |
2219 | + 'SERIOUS ERROR: Another process released this machine ' |
2220 | + 'before we could, which means two processes provisioned ' |
2221 | + 'the same machine simultaneously') |
2222 | elif update > 1: |
2223 | raise UTAHProvisioningInventoryException( |
2224 | - 'Multiple machines exist matching those criteria; ' |
2225 | - 'database ' + self.db + ' may be corrupt') |
2226 | + 'Multiple machines exist matching those criteria; ' |
2227 | + 'database ' + self.db + ' may be corrupt') |
2228 | else: |
2229 | raise UTAHProvisioningInventoryException( |
2230 | - 'Negative rowcount returned ' |
2231 | - 'when attempting to release machine') |
2232 | + 'Negative rowcount returned ' |
2233 | + 'when attempting to release machine') |
2234 | |
2235 | # Here is how I currently create the database: |
2236 | # CREATE TABLE machines (machineid INTEGER PRIMARY KEY, |
2237 | |
2238 | === modified file 'utah/publish.py' |
2239 | --- utah/publish.py 2012-12-03 14:02:18 +0000 |
2240 | +++ utah/publish.py 2012-12-08 02:12:21 +0000 |
2241 | @@ -47,41 +47,41 @@ |
2242 | 'runlist': { |
2243 | 'type': 'string', |
2244 | 'required': True, |
2245 | - }, |
2246 | + }, |
2247 | 'commands': { |
2248 | 'type': 'array', |
2249 | 'items': {'type': COMMAND_SCHEMA}, |
2250 | 'required': True, |
2251 | - }, |
2252 | + }, |
2253 | 'fetch_errors': { |
2254 | 'type': 'integer', |
2255 | 'required': True, |
2256 | - }, |
2257 | + }, |
2258 | 'errors': { |
2259 | 'type': 'integer', |
2260 | 'required': True, |
2261 | - }, |
2262 | + }, |
2263 | 'failures': { |
2264 | 'type': 'integer', |
2265 | 'required': True, |
2266 | - }, |
2267 | + }, |
2268 | 'passes': { |
2269 | 'type': 'integer', |
2270 | 'required': True, |
2271 | - }, |
2272 | + }, |
2273 | 'uname': { |
2274 | 'type': 'array', |
2275 | 'items': {'type': 'string'}, |
2276 | 'required': True, |
2277 | - }, |
2278 | + }, |
2279 | 'media-info': { |
2280 | 'type': 'string', |
2281 | 'required': True, |
2282 | - }, |
2283 | + }, |
2284 | 'install_type': { |
2285 | 'type': 'string', |
2286 | 'required': True, |
2287 | - }, |
2288 | + }, |
2289 | }, |
2290 | } |
2291 | |
2292 | @@ -135,7 +135,7 @@ |
2293 | |
2294 | if __name__ == "__main__": |
2295 | parser = argparse.ArgumentParser( |
2296 | - description='utah results publisher' |
2297 | + description='utah results publisher' |
2298 | ) |
2299 | parser.add_argument('logfile', metavar='LOGFILE', type=str, |
2300 | help="utah client results log") |
2301 | |
2302 | === modified file 'utah/timeout.py' |
2303 | --- utah/timeout.py 2012-12-03 14:02:18 +0000 |
2304 | +++ utah/timeout.py 2012-12-08 02:12:21 +0000 |
2305 | @@ -53,8 +53,9 @@ |
2306 | try: |
2307 | return command(*args, **kw) |
2308 | except UTAHTimeout: |
2309 | - raise UTAHTimeout(commandstr(command, *args, **kw) |
2310 | - + ' timed out after ' + str(timeout) + ' seconds') |
2311 | + raise UTAHTimeout( |
2312 | + commandstr(command, *args, **kw) |
2313 | + + ' timed out after ' + str(timeout) + ' seconds') |
2314 | else: |
2315 | signal.signal(signal.SIGALRM, alarm_handler) |
2316 | signal.alarm(timeout) |
2317 | @@ -64,8 +65,9 @@ |
2318 | signal.alarm(0) |
2319 | return retval |
2320 | except UTAHTimeout: |
2321 | - raise UTAHTimeout(commandstr(command, *args, **kw) |
2322 | - + ' timed out after ' + str(timeout) + ' seconds') |
2323 | + raise UTAHTimeout( |
2324 | + commandstr(command, *args, **kw) |
2325 | + + ' timed out after ' + str(timeout) + ' seconds') |
2326 | |
2327 | |
2328 | def subprocesstimeout(timeout, *args, **kw): |
Looks good to me. Also, I've run the `pass.run` runlist with a desktop i386
image and worked fine.