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