Merge lp:~craig.magina/junk/pandakit into lp:~racb/junk/pandakit
- pandakit
- Merge into pandakit
Proposed by
Craig Magina
Status: | Needs review |
---|---|
Proposed branch: | lp:~craig.magina/junk/pandakit |
Merge into: | lp:~racb/junk/pandakit |
Diff against target: |
813 lines (+445/-53) 19 files modified
armadaxp-install.expect (+46/-0) armadaxp.expect (+1/-1) console-ro (+5/-1) console-rw (+5/-1) debian/changelog (+22/-0) debian/control (+3/-3) debian/install (+7/-2) defaults.yaml (+62/-19) generic-boot.expect (+16/-0) generic-install.expect (+23/-0) generic.expect (+1/-1) pandakit.rtupdate (+6/-0) pandakit/ipmi.py (+30/-2) pandakit/pk.py (+8/-3) pandakit/toecap.py (+29/-11) preseed.amd64 (+69/-0) preseed.arm (+19/-9) preseed.ml (+65/-0) preseed.remote (+28/-0) |
To merge this branch: | bzr merge lp:~craig.magina/junk/pandakit |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robie Basak | Pending | ||
Review via email: mp+193144@code.launchpad.net |
Commit message
Description of the change
Merged all changes made locally
To post a comment you must log in.
lp:~craig.magina/junk/pandakit
updated
- 95. By Craig Magina
-
Added configuration fields to specify raw power on and off commands for ipmi
Merged local changes - 96. By Craig Magina
-
* Fixed a bug with the SSH global defines in toecap
* Minor cleanup from merge that broke installs
* Added new files in debian/install
* Added new recommends on conserver - 97. By Craig Magina
-
Applied Massimo's sentrysnmp changes to support the cdu's user in 1ss
Unmerged revisions
- 97. By Craig Magina
-
Applied Massimo's sentrysnmp changes to support the cdu's user in 1ss
- 96. By Craig Magina
-
* Fixed a bug with the SSH global defines in toecap
* Minor cleanup from merge that broke installs
* Added new files in debian/install
* Added new recommends on conserver - 95. By Craig Magina
-
Added configuration fields to specify raw power on and off commands for ipmi
Merged local changes - 94. By Craig Magina
-
Merged all modifications from local system
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'armadaxp-install.expect' |
2 | --- armadaxp-install.expect 1970-01-01 00:00:00 +0000 |
3 | +++ armadaxp-install.expect 2014-02-07 20:43:02 +0000 |
4 | @@ -0,0 +1,46 @@ |
5 | +#!/usr/bin/expect -f |
6 | + |
7 | +set hostname [lindex $argv 0] |
8 | +spawn /usr/lib/pandakit/console-rw $hostname |
9 | +set timeout 30 |
10 | +expect { |
11 | + -ex "Hit any key to stop autoboot:" {send "\n"} |
12 | + timeout {send_user "timed out\n"; exit 1} |
13 | +} |
14 | +expect { |
15 | + -ex "Marvell>> " {sleep 2;send "dhcp\n"} |
16 | + timeout {send_user "timed out\n"; exit 1} |
17 | +} |
18 | +expect { |
19 | + timeout {send_user "timed out\n"; exit 1} |
20 | + -ex "egiga0 mvNetaPortEnable failed" {send_user "known race\n"; exit 75} |
21 | + -ex "Retry count exceeded" {send_user "bootp error\n"; exit 1} |
22 | + -ex "DHCP client bound to address" |
23 | +} |
24 | +expect { |
25 | + -ex "Marvell>> " {send "pxe get\n"} |
26 | + timeout {send_user "timed out\n"; exit 1} |
27 | +} |
28 | +expect { |
29 | + -ex "Marvell>> " {send "pxe boot\n"} |
30 | + timeout {send_user "timed out\n"; exit 1} |
31 | +} |
32 | +expect { |
33 | + timeout {send_user "timed out\n"; exit 1} |
34 | + -ex "Starting kernel ..." |
35 | +} |
36 | +set timeout 1900 |
37 | +expect { |
38 | + timeout {send_user "timed out\n"; exit 1} |
39 | + "Error parsing config file" {exit 4} |
40 | +# "Uncompressing Linux" {exit 99} |
41 | +# "Detecting network hardwar" {exit 0} |
42 | + "Oops" {exit 2} |
43 | + "panic occurred" {exit 6} |
44 | + "Kernel panic" {sleep 60; exit 7} |
45 | + "The debootstrap program exited with an error (return value 1)" {exit 3} |
46 | + "Press enter to continue" {exit 5} |
47 | +# "Prompt: '?' for help>" as well as "Prompt: '?' for help, default=1>" |
48 | + "Prompt: '?' for help" {exit 8} |
49 | + "Restarting system." {exit 0} |
50 | +} |
51 | |
52 | === modified file 'armadaxp.expect' |
53 | --- armadaxp.expect 2012-07-04 14:00:28 +0000 |
54 | +++ armadaxp.expect 2014-02-07 20:43:02 +0000 |
55 | @@ -29,7 +29,7 @@ |
56 | timeout {send_user "timed out\n"; exit 1} |
57 | -ex "Starting kernel ..." |
58 | } |
59 | -set timeout 1900 |
60 | +set timeout 3200 |
61 | expect { |
62 | timeout {send_user "timed out\n"; exit 1} |
63 | "Error parsing config file" {exit 4} |
64 | |
65 | === modified file 'console-ro' |
66 | --- console-ro 2012-03-21 11:59:24 +0000 |
67 | +++ console-ro 2014-02-07 20:43:02 +0000 |
68 | @@ -16,7 +16,11 @@ |
69 | hostname = sys.argv[1] |
70 | console = local_setup['machines'][hostname]['console'] |
71 | if console['driver'] == 'conserver': |
72 | - subprocess.check_call('while true;do sleep 999999;done|console -p3109 -Mlocalhost -s "%s"|(sed -n 2q;cat)' % hostname, shell=True) |
73 | + if 'master' in console: |
74 | + master = console['master'] |
75 | + else: |
76 | + master = 'localhost' |
77 | + subprocess.check_call('while true;do sleep 999999;done|console -p3109 -M "%s" -s "%s"|(sed -n 2q;cat)' % (master,hostname), shell=True) |
78 | elif console['driver'] == 'tty': |
79 | baud = console['baud'] |
80 | tty = console['tty'] |
81 | |
82 | === modified file 'console-rw' |
83 | --- console-rw 2012-03-27 11:24:34 +0000 |
84 | +++ console-rw 2014-02-07 20:43:02 +0000 |
85 | @@ -10,6 +10,10 @@ |
86 | hostname = sys.argv[1] |
87 | console = local_setup['machines'][hostname]['console'] |
88 | if console['driver'] == 'conserver': |
89 | - subprocess.check_call('console -f -p3109 -Mlocalhost "%s"' % hostname, shell=True) |
90 | + if 'master' in console: |
91 | + master = console['master'] |
92 | + else: |
93 | + master = 'localhost' |
94 | + subprocess.check_call('console -f -p3109 -M "%s" "%s"' % (master,hostname), shell=True) |
95 | else: |
96 | raise NotImplementedError() |
97 | |
98 | === modified file 'debian/changelog' |
99 | --- debian/changelog 2012-03-08 16:55:18 +0000 |
100 | +++ debian/changelog 2014-02-07 20:43:02 +0000 |
101 | @@ -1,3 +1,25 @@ |
102 | +pandakit (0.1-4) precise; urgency=low |
103 | + |
104 | + * Fixed a bug with the SSH global defines in toecap |
105 | + |
106 | + -- Craig Magina <craig.magina@canonical.com> Sun, 15 Dec 2013 17:03:00 -0500 |
107 | + |
108 | +pandakit (0.1-3) precise; urgency=low |
109 | + |
110 | + * Minor cleanup from merge that broke installs |
111 | + * Added new files in debian/install |
112 | + * Added new recommends on conserver |
113 | + |
114 | + -- Craig Magina <craig.magina@canonical.com> Tue, 10 Dec 2013 14:43:24 -0400 |
115 | + |
116 | +pandakit (0.1-2) precise; urgency=low |
117 | + |
118 | + * Added configuration fields to specify raw power on and off commands for |
119 | + ipmi |
120 | + * Merged local changes |
121 | + |
122 | + -- Craig Magina <craig.magina@canonical.com> Fri, 01 Nov 2013 18:06:44 -0400 |
123 | + |
124 | pandakit (0.1-1) precise; urgency=low |
125 | |
126 | * Initial release. |
127 | |
128 | === modified file 'debian/control' |
129 | --- debian/control 2012-05-18 14:24:21 +0000 |
130 | +++ debian/control 2014-02-07 20:43:02 +0000 |
131 | @@ -3,13 +3,13 @@ |
132 | Priority: optional |
133 | Maintainer: Robie Basak <robie.basak@canonical.com> |
134 | Standards-Version: 3.9.3.1 |
135 | -Build-Depends: debhelper (>= 7), python-all-dev (>= 2.7), python-support |
136 | +Build-Depends: debhelper (>= 7), python-all-dev (>= 2.7), python-support, python-setuptools |
137 | XS-Python-Version: >= 2.7 |
138 | |
139 | Package: pandakit |
140 | Architecture: all |
141 | Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, expect, cobbler, python-usb, snmp, socat, python-lockfile |
142 | -Recommends: u-boot-linaro-omap4-panda-splusb, ipmitool |
143 | +Recommends: u-boot-linaro-omap4-panda-splusb, ipmitool, conserver-server, conserver-client |
144 | XB-Python-Version: ${python:Versions} |
145 | Provides: ${python:Provides} |
146 | -Description: tools to automate Pandaboard development |
147 | +Description: tools to automate ARM board development |
148 | |
149 | === modified file 'debian/install' |
150 | --- debian/install 2012-07-04 14:00:28 +0000 |
151 | +++ debian/install 2014-02-07 20:43:02 +0000 |
152 | @@ -2,12 +2,16 @@ |
153 | console-ro usr/lib/pandakit |
154 | console-rw usr/lib/pandakit |
155 | cobbler-clean usr/lib/pandakit |
156 | -generic.expect usr/lib/pandakit |
157 | -armadaxp.expect usr/lib/pandakit |
158 | +generic-install.expect usr/lib/pandakit |
159 | +generic-boot.expect usr/lib/pandakit |
160 | +armadaxp-install.expect usr/lib/pandakit |
161 | omap4-netboot-mkcard.sh usr/lib/pandakit |
162 | preseed.arm usr/share/pandakit |
163 | preseed.armadaxp usr/share/pandakit |
164 | +preseed.armadaxp_z1 usr/share/pandakit |
165 | preseed.i386 usr/share/pandakit |
166 | +preseed.amd64 usr/share/pandakit |
167 | +preseed.remote usr/share/pandakit |
168 | relay-kmtronic usr/lib/pandakit |
169 | remote-netboot.py usr/lib/pandakit |
170 | ttyusb-dev usr/lib/pandakit |
171 | @@ -15,3 +19,4 @@ |
172 | local_setup.yaml etc/pandakit |
173 | defaults.yaml etc/pandakit |
174 | 85-pandakit.rules /lib/udev/rules.d |
175 | +pandakit.rtupdate usr/share/python/runtime.d |
176 | \ No newline at end of file |
177 | |
178 | === modified file 'defaults.yaml' |
179 | --- defaults.yaml 2012-07-04 15:10:26 +0000 |
180 | +++ defaults.yaml 2014-02-07 20:43:02 +0000 |
181 | @@ -1,20 +1,28 @@ |
182 | -default_keywords: [ generic, armhf, quantal ] |
183 | +default_keywords: [ generic, armhf, raring ] |
184 | settings: |
185 | preseed: '/usr/share/pandakit/%(preseed)s' |
186 | kernel: '%(mirror)s/dists/%(release)s/main/installer-%(arch)s/current/images/%(installer)s/%(kernel_name)s' |
187 | initrd: '%(mirror)s/dists/%(release)s/main/installer-%(arch)s/current/images/%(installer)s/%(initrd_name)s' |
188 | kopts: '%(kopts)s DEBIAN_FRONTEND=text' |
189 | - monitor: '/usr/lib/pandakit/%(monitor)s.expect' |
190 | + boot_monitor: '/usr/lib/pandakit/%(boot_monitor)s.expect' |
191 | + install_monitor: '/usr/lib/pandakit/%(install_monitor)s.expect' |
192 | settings_exceptions: |
193 | # These are regular expression pairs |
194 | # Workaround for precise netboot images being in a slightly different path |
195 | # on armadaxp |
196 | +# kernel: |
197 | +# - - '/dists/precise/main/installer-armhf/current/images/armadaxp/netboot/uImage$' |
198 | +# - '/dists/precise/main/installer-armhf/current/images/armadaxp/uImage' |
199 | +# initrd: |
200 | +# - - '/dists/precise/main/installer-armhf/current/images/armadaxp/netboot/uInitrd$' |
201 | +# - '/dists/precise/main/installer-armhf/current/images/armadaxp/uInitrd' |
202 | + # On highbank in precise, the installer is only available in the -updates pocket |
203 | kernel: |
204 | - - - '/dists/precise/main/installer-armhf/current/images/armadaxp/netboot/uImage$' |
205 | - - '/dists/precise/main/installer-armhf/current/images/armadaxp/uImage' |
206 | + - - '/dists/precise/main/installer-armhf/current/images/highbank/netboot/vmlinuz$' |
207 | + - '/dists/precise-updates/main/installer-armhf/current/images/highbank/netboot/vmlinuz' |
208 | initrd: |
209 | - - - '/dists/precise/main/installer-armhf/current/images/armadaxp/netboot/uInitrd$' |
210 | - - '/dists/precise/main/installer-armhf/current/images/armadaxp/uInitrd' |
211 | + - - '/dists/precise/main/installer-armhf/current/images/highbank/netboot/initrd.gz$' |
212 | + - '/dists/precise-updates/main/installer-armhf/current/images/highbank/netboot/initrd.gz' |
213 | keyword_map: |
214 | armel: |
215 | mirror: http://ports.ubuntu.com/ubuntu-ports |
216 | @@ -28,34 +36,69 @@ |
217 | kernel_name: uImage |
218 | initrd_name: uInitrd |
219 | preseed: preseed.arm |
220 | - i386: |
221 | + amd64: |
222 | mirror: http://archive.ubuntu.com/ubuntu |
223 | - arch: i386 |
224 | - installer: netboot/ubuntu-installer/i386 |
225 | + arch: amd64 |
226 | + installer: netboot/ubuntu-installer/amd64 |
227 | kernel_name: linux |
228 | initrd_name: initrd.gz |
229 | - preseed: preseed.i386 |
230 | + preseed: preseed.amd64 |
231 | + lpae: |
232 | + installer: generic-lpae/netboot |
233 | oneiric: |
234 | release: oneiric |
235 | precise: |
236 | release: precise |
237 | + precise-updates: |
238 | + release: precise-updates |
239 | quantal: |
240 | release: quantal |
241 | + quantal-updates: |
242 | + release: quantal-updates |
243 | + raring: |
244 | + release: raring |
245 | + raring-updates: |
246 | + release: raring-updates |
247 | + saucy: |
248 | + release: saucy |
249 | + saucy-updates: |
250 | + release: saucy-updates |
251 | + trusty: |
252 | + release: trusty |
253 | + trusty-updates: |
254 | + release: trusty-updates |
255 | generic: |
256 | - monitor: generic |
257 | + boot_monitor: generic-boot |
258 | + install_monitor: generic-install |
259 | kopts: '' |
260 | omap4: |
261 | installer: omap4/netboot |
262 | - kopts: 'console=ttyO2,115200n8 earlyprintk=ttyO2 text fixrtc' |
263 | + kopts: 'console=ttyO2,115200n8 earlyprintk=ttyO2 text fixrtc vram=48M omapfb.vram=0:24M' |
264 | + omap4-proposed: |
265 | + installer: omap4/netboot |
266 | + kopts: 'apt-setup/proposed=true console=ttyO2,115200n8 earlyprintk=ttyO2 text fixrtc' |
267 | armadaxp: |
268 | installer: armadaxp/netboot |
269 | - preseed: preseed.armadaxp |
270 | - monitor: armadaxp |
271 | - kopts: 'console=ttyS0,115200n8 earlyprintk=ttyS0 text netcfg/choose_interface=auto fixrtc' |
272 | - armadaxp_z1: |
273 | - preseed: preseed.armadaxp_z1 |
274 | + install_monitor: armadaxp-install |
275 | + kopts: 'console=ttyS0,115200n8 earlyprintk=ttyS0 text netcfg/choose_interface=auto fixrtc' |
276 | + armadaxp-proposed: |
277 | + installer: armadaxp/netboot |
278 | + install_monitor: armadaxp-install |
279 | + kopts: 'apt-setup/proposed=true console=ttyS0,115200n8 earlyprintk=ttyS0 text netcfg/choose_interface=auto fixrtc' |
280 | + armadaxp-z1: |
281 | + preseed: preseed.armadaxp-z1 |
282 | + # Need to specify a local hand-built installer somehow for Z1 |
283 | + installer: armadaxp-z1/netboot |
284 | + install_monitor: armadaxp-install |
285 | + kopts: 'console=ttyS0,115200n8 earlyprintk=ttyS0 text netcfg/choose_interface=auto fixrtc' |
286 | highbank: |
287 | - installer: highbank/netboot |
288 | - kopts: 'console=ttyAMA0 earlyprintk=ttyAMA0 text netcfg/choose_interface=auto' |
289 | + release: quantal |
290 | + installer: highbank/netboot |
291 | + kopts: 'console=ttyAMA0 earlyprintk=ttyAMA0 text netcfg/choose_interface=auto fixrtc' |
292 | + kernel_name: vmlinuz |
293 | + initrd_name: initrd.gz |
294 | + highbank-proposed: |
295 | + installer: highbank/netboot |
296 | + kopts: 'apt-setup/proposed=true console=ttyAMA0 earlyprintk=ttyAMA0 text netcfg/choose_interface=auto fixrtc' |
297 | kernel_name: vmlinuz |
298 | initrd_name: initrd.gz |
299 | |
300 | === added file 'generic-boot.expect' |
301 | --- generic-boot.expect 1970-01-01 00:00:00 +0000 |
302 | +++ generic-boot.expect 2014-02-07 20:43:02 +0000 |
303 | @@ -0,0 +1,16 @@ |
304 | +#!/usr/bin/expect -f |
305 | + |
306 | +set timeout 1600 |
307 | +spawn pk console $argv |
308 | +expect { |
309 | + timeout {send_user "timed out\n"; exit 1} |
310 | +# "Uncompressing Linux" {exit 99} |
311 | +# "Detecting network hardwar" {exit 0} |
312 | + "Oops" {exit 2} |
313 | + "panic occurred" {exit 6} |
314 | + "Kernel panic" {sleep 60; exit 7} |
315 | + "Press enter to continue" {exit 5} |
316 | +# "Prompt: '?' for help>" as well as "Prompt: '?' for help, default=1>" |
317 | + "Prompt: '?' for help" {exit 8} |
318 | + "login:" {exit 0} |
319 | +} |
320 | |
321 | === added file 'generic-install.expect' |
322 | --- generic-install.expect 1970-01-01 00:00:00 +0000 |
323 | +++ generic-install.expect 2014-02-07 20:43:02 +0000 |
324 | @@ -0,0 +1,23 @@ |
325 | +#!/usr/bin/expect -f |
326 | + |
327 | +set timeout 1900 |
328 | +spawn pk console $argv |
329 | +expect { |
330 | + "ERROR: Debootstrap warning" {exit 75} |
331 | + "You have not selected any partitions for use as swap space." {exit 75} |
332 | + "Could not stat device" {exit 75} |
333 | + "No root file system is defined." {exit 75} |
334 | + "ERROR: Installation step failed" {exit 75} |
335 | + timeout {send_user "timed out\n"; exit 1} |
336 | + "Error parsing config file" {exit 4} |
337 | +# "Uncompressing Linux" {exit 99} |
338 | +# "Detecting network hardwar" {exit 0} |
339 | + "Oops" {exit 2} |
340 | + "panic occurred" {exit 6} |
341 | + "Kernel panic" {sleep 60; exit 7} |
342 | + "The debootstrap program exited with an error (return value 1)" {exit 3} |
343 | + "Press enter to continue" {exit 5} |
344 | +# "Prompt: '?' for help>" as well as "Prompt: '?' for help, default=1>" |
345 | + "Prompt: '?' for help" {exit 8} |
346 | + "Restarting system." {exit 0} |
347 | +} |
348 | |
349 | === modified file 'generic.expect' |
350 | --- generic.expect 2012-04-03 14:30:44 +0000 |
351 | +++ generic.expect 2014-02-07 20:43:02 +0000 |
352 | @@ -1,6 +1,6 @@ |
353 | #!/usr/bin/expect -f |
354 | |
355 | -set timeout 1600 |
356 | +set timeout 3200 |
357 | spawn pk console $argv |
358 | expect { |
359 | "ERROR: Debootstrap warning" {exit 75} |
360 | |
361 | === added file 'pandakit.rtupdate' |
362 | --- pandakit.rtupdate 1970-01-01 00:00:00 +0000 |
363 | +++ pandakit.rtupdate 2014-02-07 20:43:02 +0000 |
364 | @@ -0,0 +1,6 @@ |
365 | +#! /bin/sh |
366 | +set -e |
367 | +if [ "$1" = rtupdate ]; then |
368 | + pyclean -p pandakit /usr/lib/pandakit |
369 | + pycompile -p pandakit -V 2.7- /usr/lib/pandakit |
370 | +fi |
371 | \ No newline at end of file |
372 | |
373 | === modified file 'pandakit/ipmi.py' |
374 | --- pandakit/ipmi.py 2012-05-19 00:14:47 +0000 |
375 | +++ pandakit/ipmi.py 2014-02-07 20:43:02 +0000 |
376 | @@ -13,6 +13,29 @@ |
377 | bmc = machine['bmc'] |
378 | return bmc['ip_address'] |
379 | |
380 | +def get_bmc_user(machine_name): |
381 | + machines = config.get_config()['machines'] |
382 | + machine = machines[machine_name] |
383 | + bmc = machine['bmc'] |
384 | + return bmc['username'] |
385 | + |
386 | +def get_bmc_pwd(machine_name): |
387 | + machines = config.get_config()['machines'] |
388 | + machine = machines[machine_name] |
389 | + bmc = machine['bmc'] |
390 | + return bmc['password'] |
391 | + |
392 | +def get_bmc_intf(machine_name): |
393 | + machines = config.get_config()['machines'] |
394 | + machine = machines[machine_name] |
395 | + bmc = machine['bmc'] |
396 | + try: |
397 | + return bmc['intf'] |
398 | + except KeyError: |
399 | + return 'lan' |
400 | + else: |
401 | + return bmc['intf'] |
402 | + |
403 | def has_bmc(machine_name): |
404 | try: |
405 | get_bmc_ip(machine_name) |
406 | @@ -23,11 +46,16 @@ |
407 | |
408 | def sol(machine_name): |
409 | bmc_ip = get_bmc_ip(machine_name) |
410 | - os.execlp('socat', 'socat', '-,echo=0,raw', 'EXEC:ipmitool -H %s -U admin -P admin -I lanplus sol activate,pty' % bmc_ip) |
411 | + bmc_user = get_bmc_user(machine_name) |
412 | + bmc_pwd = get_bmc_pwd(machine_name) |
413 | + os.execlp('socat', 'socat', '-,echo=0,raw', 'EXEC:ipmitool -H %s -U %s -P %s -I lanplus sol activate,pty' % (bmc_ip, bmc_user, bmc_pwd) ) |
414 | |
415 | def ipmi(machine_name, *args): |
416 | bmc_ip = get_bmc_ip(machine_name) |
417 | - cmd = ['ipmitool', '-H', bmc_ip, '-U', 'admin', '-P', 'admin'] |
418 | + bmc_user = get_bmc_user(machine_name) |
419 | + bmc_pwd = get_bmc_pwd(machine_name) |
420 | + bmc_intf = get_bmc_intf(machine_name) |
421 | + cmd = ['ipmitool', '-H', bmc_ip, '-U', bmc_user, '-P', bmc_pwd, '-I', bmc_intf] |
422 | cmd.extend(args) |
423 | subprocess.check_call(cmd, close_fds=True) |
424 | time.sleep(3) |
425 | |
426 | === modified file 'pandakit/pk.py' |
427 | --- pandakit/pk.py 2013-09-23 13:54:30 +0000 |
428 | +++ pandakit/pk.py 2014-02-07 20:43:02 +0000 |
429 | @@ -18,9 +18,9 @@ |
430 | for hostname in hostnames: |
431 | machine_definition = local_config['machines'][hostname] |
432 | if 'bmc' in machine_definition: |
433 | - if 'raw' in machine_definition: |
434 | - pandakit.ipmi.main(hostname, machine_definition['bmc']['raw'][state]) |
435 | - else: |
436 | + try: |
437 | + pandakit.ipmi.main(hostname, *machine_definition['bmc'][state + '-cmd'].split()) |
438 | + except KeyError: |
439 | pandakit.ipmi.main(hostname, 'power', state) |
440 | elif 'relay' in machine_definition: |
441 | relay_name = machine_definition['relay']['name'] |
442 | @@ -41,6 +41,11 @@ |
443 | relay_index = local_config['machines'][hostname]['relay']['index'] |
444 | state_code = { 'on': 1, 'off': 2, 'reset': 3 }[state] |
445 | subprocess.check_call('snmpset -c private -v1 %s .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.%d i %d >/dev/null' % (host, relay_index, state_code), shell=True) |
446 | + elif relay['driver'] == 'sentrysnmp': |
447 | + host = relay['host'] |
448 | + relay_index = local_config['machines'][hostname]['relay']['index'] |
449 | + state_code = { 'on': 1, 'off': 2, 'reset': 3 }[state] |
450 | + subprocess.check_call('snmpset -c private -v1 %s .1.3.6.1.4.1.1718.3.2.3.1.11.1.1.%d i %d >/dev/null' % (host, relay_index, state_code), shell=True) |
451 | else: |
452 | print "Power cycle %s and press enter" % hostname |
453 | raw_input() |
454 | |
455 | === modified file 'pandakit/toecap.py' |
456 | --- pandakit/toecap.py 2012-07-04 15:10:26 +0000 |
457 | +++ pandakit/toecap.py 2014-02-07 20:43:02 +0000 |
458 | @@ -32,8 +32,6 @@ |
459 | except: |
460 | HOME = os.getenv('HOME') |
461 | |
462 | -SSH_KNOWN_HOSTS_FILE = os.path.join(HOME, '.ssh', 'known_hosts') |
463 | -SSH_ID_RSA_PUB_FILE = os.path.join(HOME, '.ssh', 'id_rsa.pub') |
464 | USBBOOT_DEVPATH_DIR = '/var/run/pandakit/usbboot' |
465 | COBBLER_LOCK = '/var/run/pandakit/cobbler' |
466 | COBBLER_LOCK_DIR = os.path.dirname(COBBLER_LOCK) |
467 | @@ -167,7 +165,7 @@ |
468 | return 'console' in config.get_config()['machines'][hostname] |
469 | |
470 | |
471 | -def do_boot(args): |
472 | +def do_install(args): |
473 | if args.ip_address: |
474 | sudo_user = os.getenv('SUDO_USER') |
475 | if sudo_user: |
476 | @@ -183,10 +181,10 @@ |
477 | if ipmi.has_bmc(args.hostname): |
478 | ipmi.main(args.hostname, 'chassis', 'bootdev', 'pxe') |
479 | |
480 | - if args.monitor and has_console(args.hostname): |
481 | + if args.install_monitor and has_console(args.hostname): |
482 | # Start the monitor before resetting the board, so that it doesn't |
483 | # miss anything from the moment the board powers on. |
484 | - monitor = subprocess.Popen([args.monitor, args.hostname]) |
485 | + monitor = subprocess.Popen([args.install_monitor, args.hostname]) |
486 | subprocess.check_call(['pk', 'power', 'on', args.hostname]) |
487 | exit_status = monitor.wait() |
488 | return exit_status |
489 | @@ -196,6 +194,12 @@ |
490 | raw_input() |
491 | return 0 |
492 | |
493 | +def boot_monitor(args): |
494 | + if args.boot_monitor and has_console(args.hostname): |
495 | + monitor = subprocess.Popen([args.boot_monitor, args.hostname]) |
496 | + exit_status = monitor.wait() |
497 | + return exit_status |
498 | + |
499 | |
500 | def assign_defaults(args): |
501 | local_setup = config.get_config() |
502 | @@ -211,7 +215,8 @@ |
503 | keywords_to_apply = itertools.chain(default['default_keywords'], |
504 | machine_keywords, |
505 | args.keywords) |
506 | - settings_to_apply = ['kernel', 'initrd', 'preseed', 'kopts', 'monitor'] |
507 | + settings_to_apply = ['kernel', 'initrd', 'preseed', 'kopts', |
508 | + 'boot_monitor', 'install_monitor'] |
509 | |
510 | for keyword in keywords_to_apply: |
511 | keyword_assignments.update(default['keyword_map'][keyword]) |
512 | @@ -248,6 +253,7 @@ |
513 | pass |
514 | |
515 | if 'ssh_key' not in os.environ: |
516 | + SSH_ID_RSA_PUB_FILE = os.path.join(HOME, '.ssh', 'id_rsa.pub') |
517 | try: |
518 | f = open(SSH_ID_RSA_PUB_FILE, 'r') |
519 | except IOError, e: |
520 | @@ -266,7 +272,8 @@ |
521 | parser.add_argument('--initrd') |
522 | parser.add_argument('--preseed') |
523 | parser.add_argument('--kopts') |
524 | - parser.add_argument('--monitor') |
525 | + parser.add_argument('--boot-monitor') |
526 | + parser.add_argument('--install-monitor') |
527 | parser.add_argument('--ip-address') |
528 | parser.add_argument('--usb-spl') |
529 | parser.add_argument('--tries', type=int, default=1) |
530 | @@ -319,7 +326,7 @@ |
531 | print "Removing temporary cobbler config" |
532 | cobbler_teardown(*context) |
533 | teardown_functions.append(teardown_cobbler) |
534 | - |
535 | + |
536 | if args.usb_spl: |
537 | mkdir_p(USBBOOT_DEVPATH_DIR) |
538 | usbboot_devpath = os.path.join(USBBOOT_DEVPATH_DIR, args.usb_spl) |
539 | @@ -328,7 +335,7 @@ |
540 | os.unlink(usbboot_devpath) |
541 | teardown_functions.append(teardown_usb_spl) |
542 | |
543 | - exit_status = do_boot(args) |
544 | + exit_status = do_install(args) |
545 | |
546 | finally: |
547 | for f in teardown_functions: |
548 | @@ -336,16 +343,27 @@ |
549 | |
550 | # Exit if the monitor reported a problem |
551 | if exit_status: |
552 | - print >>sys.stderr, 'Monitor returned status %d' % exit_status |
553 | + print >>sys.stderr, 'Install Monitor returned status %d' % exit_status |
554 | + return exit_status |
555 | + |
556 | + exit_status = boot_monitor(args) |
557 | + # Exit if the monitor reported a problem |
558 | + if exit_status: |
559 | + print >>sys.stderr, 'Boot Monitor returned status %d' % exit_status |
560 | return exit_status |
561 | |
562 | if args.ip_address: |
563 | + SSH_KNOWN_HOSTS_FILE = os.path.join(HOME, '.ssh', 'known_hosts') |
564 | keyscan = subprocess.Popen(['ssh-keyscan', args.ip_address], |
565 | stdout=subprocess.PIPE) |
566 | keyscan_output = keyscan.communicate()[0] |
567 | if keyscan.returncode: |
568 | sys.exit(keyscan.returncode) |
569 | - with open(SSH_KNOWN_HOSTS_FILE, 'a') as f: |
570 | + if os.path.exists(SSH_KNOWN_HOSTS_FILE): |
571 | + fmode = 'a' |
572 | + else: |
573 | + fmode = 'w' |
574 | + with open(SSH_KNOWN_HOSTS_FILE, fmode) as f: |
575 | f.write(keyscan_output) |
576 | |
577 | return 0 |
578 | |
579 | === added file 'preseed.amd64' |
580 | --- preseed.amd64 1970-01-01 00:00:00 +0000 |
581 | +++ preseed.amd64 2014-02-07 20:43:02 +0000 |
582 | @@ -0,0 +1,69 @@ |
583 | +d-i anna/choose_modules string network-console parted-udeb |
584 | +d-i network-console/password password ubuntu |
585 | +d-i network-console/password-again password ubuntu |
586 | +d-i network-console/start note |
587 | +d-i clock-setup/ntp boolean true |
588 | +d-i clock-setup/ntp-server string ntp.ubuntu.com |
589 | +d-i clock-setup/utc-auto boolean true |
590 | +d-i console-setup/ask_detect boolean false |
591 | +d-i debian-installer/exit/restart boolean true |
592 | +d-i finish-install/reboot_in_progress note |
593 | +d-i pkgsel/upgrade select full-upgrade |
594 | +d-i pkgsel/update-policy select none |
595 | +d-i pkgsel/updatedb boolean false |
596 | +d-i netcfg/get_hostname string unassigned-hostname |
597 | +d-i netcfg/get_domain string unassigned-domain |
598 | +d-i partman-auto/disk string /dev/sda |
599 | +d-i partman-auto/method string regular |
600 | +d-i partman-auto/purge_lvm_from_device boolean true |
601 | +d-i partman-lvm/device_remove_lvm boolean true |
602 | +d-i partman-md/device_remove_md boolean true |
603 | +d-i partman-auto/expert_recipe string \ |
604 | + boot-root :: \ |
605 | + 256 256 256 ext3 \ |
606 | + $primary{{ }} $bootable{{ }} \ |
607 | + method{{ format }} format{{ }} \ |
608 | + use_filesystem{{ }} filesystem{{ ext3 }} \ |
609 | + mountpoint{{ /boot }} \ |
610 | + . \ |
611 | + 100000 100000 100000 ext4 \ |
612 | + $primary{{ }} \ |
613 | + method{{ format }} format{{ }} \ |
614 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
615 | + mountpoint{{ / }} \ |
616 | + . \ |
617 | + 1100 1100 1100 linux-swap \ |
618 | + method{{ swap }} format{{ }} \ |
619 | + . \ |
620 | + 20000 20000 20000 ext4 \ |
621 | + method{{ format }} format{{ }} \ |
622 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
623 | + label{{ TEST }} \ |
624 | + mountpoint{{ /test }} \ |
625 | + . \ |
626 | + 100 100 100 ext4 \ |
627 | + method{{ format }} format{{ }} \ |
628 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
629 | + label{{ DELETEME }} \ |
630 | + mountpoint{{ /tmp/deleteme }} \ |
631 | + . |
632 | +d-i partman-partitioning/confirm_write_new_label boolean true |
633 | +d-i partman/choose_partition select finish |
634 | +d-i partman/confirm boolean true |
635 | +d-i partman/confirm_nooverwrite boolean true |
636 | +d-i partman/mount_style select traditional |
637 | +d-i passwd/user-fullname string Ubuntu |
638 | +d-i passwd/user-password-crypted password $6$.1eHH0iY$ArGzKX2YeQ3G6U.mlOO3A.NaL22Ewgz8Fi4qqz.Ns7EMKjEJRIW2Pm/TikDptZpuu7I92frytmk5YeL.9fRY4. |
639 | +d-i passwd/username string ubuntu |
640 | +d-i user-setup/allow-password-weak boolean true |
641 | +d-i base-installer/kernel/override-image string linux-server |
642 | +d-i debian-installer/splash boolean false |
643 | +d-i pkgsel/install-language-support boolean false |
644 | +d-i pkgsel/language-pack-patterns string |
645 | +d-i pkgsel/include string openssh-server |
646 | +d-i mirror/country string manual |
647 | +d-i mirror/http/hostname string archive.ubuntu.com |
648 | +d-i mirror/http/directory string /ubuntu |
649 | +d-i mirror/http/proxy string {http_proxy} |
650 | +d-i debian-installer/locale string C |
651 | +d-i preseed/late_command string echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /target/etc/sudoers.d/pandakit; chmod 0440 /target/etc/sudoers.d/pandakit; mkdir -m700 -p /target/root/.ssh; echo {ssh_key} > /target/root/.ssh/authorized_keys; echo http_proxy={http_proxy} >> /target/etc/environment; mkdir -m700 -p /target/home/ubuntu/.ssh; cp /target/root/.ssh/authorized_keys /target/home/ubuntu/.ssh/; in-target chown -R ubuntu. /home/ubuntu/.ssh; umount -f `mount | grep deleteme | cut -f 1 -d " "`; parted /dev/sda rm `grep deleteme /target/etc/fstab | cut -f 1 -d " " | cut -f 2 -d "a"`; sed -i "/deleteme/d" /target/etc/fstab |
652 | |
653 | === modified file 'preseed.arm' |
654 | --- preseed.arm 2012-07-04 14:00:28 +0000 |
655 | +++ preseed.arm 2014-02-07 20:43:02 +0000 |
656 | @@ -1,3 +1,7 @@ |
657 | +d-i anna/choose_modules string network-console parted-udeb |
658 | +d-i network-console/password password ubuntu |
659 | +d-i network-console/password-again password ubuntu |
660 | +d-i network-console/start note |
661 | d-i clock-setup/ntp boolean true |
662 | d-i clock-setup/ntp-server string ntp.ubuntu.com |
663 | d-i clock-setup/utc-auto boolean true |
664 | @@ -16,26 +20,32 @@ |
665 | d-i partman-md/device_remove_md boolean true |
666 | d-i partman-auto/expert_recipe string \ |
667 | boot-root :: \ |
668 | - 256 256 256 ext4 \ |
669 | + 256 256 256 ext3 \ |
670 | $primary{{ }} $bootable{{ }} \ |
671 | method{{ format }} format{{ }} \ |
672 | - use_filesystem{{ }} filesystem{{ ext4 }} \ |
673 | + use_filesystem{{ }} filesystem{{ ext3 }} \ |
674 | mountpoint{{ /boot }} \ |
675 | . \ |
676 | - 4000 10000 20000 ext4 \ |
677 | + 100000 100000 100000 ext4 \ |
678 | $primary{{ }} \ |
679 | - method{{ format }} format{{ }} \ |
680 | - use_filesystem{{ }} filesystem{{ ext4 }} \ |
681 | + method{{ format }} format{{ }} \ |
682 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
683 | mountpoint{{ / }} \ |
684 | . \ |
685 | - 1100 1100 1100 linux-swap \ |
686 | - method{{ swap }} format{{ }} \ |
687 | + 1100 1100 1100 linux-swap \ |
688 | + method{{ swap }} format{{ }} \ |
689 | . \ |
690 | - 500 10000 1000000 ext4 \ |
691 | + 20000 20000 20000 ext4 \ |
692 | method{{ format }} format{{ }} \ |
693 | use_filesystem{{ }} filesystem{{ ext4 }} \ |
694 | label{{ TEST }} \ |
695 | mountpoint{{ /test }} \ |
696 | + . \ |
697 | + 100 100 100 ext4 \ |
698 | + method{{ format }} format{{ }} \ |
699 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
700 | + label{{ DELETEME }} \ |
701 | + mountpoint{{ /tmp/deleteme }} \ |
702 | . |
703 | d-i partman-partitioning/confirm_write_new_label boolean true |
704 | d-i partman/choose_partition select finish |
705 | @@ -56,4 +66,4 @@ |
706 | d-i mirror/http/directory string /ubuntu-ports |
707 | d-i mirror/http/proxy string {http_proxy} |
708 | d-i debian-installer/locale string C |
709 | -d-i preseed/late_command string echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /target/etc/sudoers.d/pandakit; chmod 0440 /target/etc/sudoers.d/pandakit; mkdir -m700 -p /target/root/.ssh; echo {ssh_key} > /target/root/.ssh/authorized_keys; echo http_proxy={http_proxy} >> /target/etc/environment; mkdir -m700 -p /target/home/ubuntu/.ssh; cp /target/root/.ssh/authorized_keys /target/home/ubuntu/.ssh/; in-target chown -R ubuntu. /home/ubuntu/.ssh |
710 | +d-i preseed/late_command string echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /target/etc/sudoers.d/pandakit; chmod 0440 /target/etc/sudoers.d/pandakit; mkdir -m700 -p /target/root/.ssh; echo {ssh_key} > /target/root/.ssh/authorized_keys; echo http_proxy={http_proxy} >> /target/etc/environment; mkdir -m700 -p /target/home/ubuntu/.ssh; cp /target/root/.ssh/authorized_keys /target/home/ubuntu/.ssh/; in-target chown -R ubuntu. /home/ubuntu/.ssh; umount -f `mount | grep deleteme | cut -f 1 -d " "`; parted /dev/sda rm `grep deleteme /target/etc/fstab | cut -f 1 -d " " | cut -f 2 -d "a"`; sed -i "/deleteme/d" /target/etc/fstab |
711 | |
712 | === added file 'preseed.ml' |
713 | --- preseed.ml 1970-01-01 00:00:00 +0000 |
714 | +++ preseed.ml 2014-02-07 20:43:02 +0000 |
715 | @@ -0,0 +1,65 @@ |
716 | +d-i anna/choose_modules string network-console parted-udeb |
717 | +d-i network-console/password password ubuntu |
718 | +d-i network-console/password-again password ubuntu |
719 | +d-i network-console/start note |
720 | +d-i clock-setup/ntp boolean true |
721 | +d-i clock-setup/ntp-server string ntp.ubuntu.com |
722 | +d-i clock-setup/utc-auto boolean true |
723 | +d-i console-setup/ask_detect boolean false |
724 | +d-i debian-installer/exit/restart boolean true |
725 | +d-i finish-install/reboot_in_progress note |
726 | +d-i pkgsel/upgrade select full-upgrade |
727 | +d-i pkgsel/update-policy select none |
728 | +d-i pkgsel/updatedb boolean false |
729 | +d-i netcfg/get_hostname string unassigned-hostname |
730 | +d-i netcfg/get_domain string unassigned-domain |
731 | +d-i partman-auto/disk string /dev/sda |
732 | +d-i partman-auto/method string regular |
733 | +d-i partman-auto/purge_lvm_from_device boolean true |
734 | +d-i partman-lvm/device_remove_lvm boolean true |
735 | +d-i partman-md/device_remove_md boolean true |
736 | +d-i partman-auto/expert_recipe string \ |
737 | + boot-root :: \ |
738 | + 256 256 256 ext3 \ |
739 | + $primary{{ }} $bootable{{ }} \ |
740 | + method{{ format }} format{{ }} \ |
741 | + use_filesystem{{ }} filesystem{{ ext3 }} \ |
742 | + mountpoint{{ /boot }} \ |
743 | + . \ |
744 | + 100000 100000 100000 ext4 \ |
745 | + $primary{{ }} \ |
746 | + method{{ format }} format{{ }} \ |
747 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
748 | + mountpoint{{ / }} \ |
749 | + . \ |
750 | + 1100 1100 1100 linux-swap \ |
751 | + method{{ swap }} format{{ }} \ |
752 | + . \ |
753 | + 20000 20000 20000 ext4 \ |
754 | + method{{ format }} format{{ }} \ |
755 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
756 | + label{{ TEST }} \ |
757 | + mountpoint{{ /test }} \ |
758 | + . \ |
759 | + 100 100 100 ext4 \ |
760 | + method{{ format }} format{{ }} \ |
761 | + use_filesystem{{ }} filesystem{{ ext4 }} \ |
762 | + label{{ DELETEME }} \ |
763 | + mountpoint{{ /tmp/deleteme }} \ |
764 | + . |
765 | +d-i partman-partitioning/confirm_write_new_label boolean true |
766 | +d-i partman/choose_partition select finish |
767 | +d-i partman/confirm boolean true |
768 | +d-i partman/confirm_nooverwrite boolean true |
769 | +d-i partman/mount_style select traditional |
770 | +d-i passwd/user-fullname string Ubuntu |
771 | +d-i passwd/user-password-crypted password $6$.1eHH0iY$ArGzKX2YeQ3G6U.mlOO3A.NaL22Ewgz8Fi4qqz.Ns7EMKjEJRIW2Pm/TikDptZpuu7I92frytmk5YeL.9fRY4. |
772 | +d-i passwd/username string ubuntu |
773 | +d-i user-setup/allow-password-weak boolean true |
774 | +d-i base-installer/kernel/override-image string linux-server |
775 | +d-i debian-installer/splash boolean false |
776 | +d-i pkgsel/install-language-support boolean false |
777 | +d-i pkgsel/language-pack-patterns string |
778 | +d-i pkgsel/include string openssh-server |
779 | +d-i debian-installer/locale string C |
780 | +d-i preseed/late_command string echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /target/etc/sudoers.d/pandakit; chmod 0440 /target/etc/sudoers.d/pandakit; mkdir -m700 -p /target/root/.ssh; echo {ssh_key} > /target/root/.ssh/authorized_keys; echo http_proxy={http_proxy} >> /target/etc/environment; mkdir -m700 -p /target/home/ubuntu/.ssh; cp /target/root/.ssh/authorized_keys /target/home/ubuntu/.ssh/; in-target chown -R ubuntu. /home/ubuntu/.ssh; umount -f `mount | grep deleteme | cut -f 1 -d " "`; parted /dev/sda rm `grep deleteme /target/etc/fstab | cut -f 1 -d " " | cut -f 2 -d "a"`; sed -i "/deleteme/d" /target/etc/fstab |
781 | |
782 | === added file 'preseed.remote' |
783 | --- preseed.remote 1970-01-01 00:00:00 +0000 |
784 | +++ preseed.remote 2014-02-07 20:43:02 +0000 |
785 | @@ -0,0 +1,28 @@ |
786 | +d-i clock-setup/ntp boolean true |
787 | +d-i clock-setup/ntp-server string ntp.ubuntu.com |
788 | +d-i clock-setup/utc-auto boolean true |
789 | +d-i console-setup/ask_detect boolean false |
790 | +d-i pkgsel/upgrade select full-upgrade |
791 | +d-i pkgsel/update-policy select none |
792 | +d-i pkgsel/updatedb boolean false |
793 | +d-i netcfg/get_hostname string unassigned-hostname |
794 | +d-i netcfg/get_domain string unassigned-domain |
795 | +d-i anna/choose_modules string network-console |
796 | +d-i network-console/password password uinst |
797 | +d-i network-console/password-again password uinst |
798 | +d-i passwd/user-fullname string Ubuntu |
799 | +d-i passwd/user-password-crypted password $6$.1eHH0iY$ArGzKX2YeQ3G6U.mlOO3A.NaL22Ewgz8Fi4qqz.Ns7EMKjEJRIW2Pm/TikDptZpuu7I92frytmk5YeL.9fRY4. |
800 | +d-i passwd/username string ubuntu |
801 | +d-i user-setup/allow-password-weak boolean true |
802 | +d-i base-installer/kernel/override-image string linux-server |
803 | +d-i debian-installer/splash boolean false |
804 | +d-i pkgsel/install-language-support boolean false |
805 | +d-i pkgsel/language-pack-patterns string |
806 | +d-i pkgsel/include string openssh-server |
807 | +d-i mirror/country string manual |
808 | +d-i mirror/http/hostname string ports.ubuntu.com |
809 | +d-i mirror/http/directory string /ubuntu-ports |
810 | +d-i mirror/http/proxy string {http_proxy} |
811 | +d-i mirror/suite string precise |
812 | +d-i debian-installer/locale string C |
813 | +d-i preseed/late_command string echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /target/etc/sudoers.d/pandakit; chmod 0440 /target/etc/sudoers.d/pandakit; mkdir -m700 -p /target/root/.ssh; echo {ssh_key} > /target/root/.ssh/authorized_keys; echo http_proxy={http_proxy} >> /target/etc/environment; mkdir -m700 -p /target/home/ubuntu/.ssh; cp /target/root/.ssh/authorized_keys /target/home/ubuntu/.ssh/; in-target chown -R ubuntu. /home/ubuntu/.ssh |