File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 33import os
44import socket
55import json
6+ import syslog
67sys .stderr = sys .stdout
78print "Content-Type: text/plain"
89print
910
11+ def pxe_abort ():
12+ """Abort the PXE boot, continue with the next boot device in the BIOS boot order"""
13+ print "#!ipxe"
14+ print "exit"
15+ sys .exit (0 )
16+
1017try :
1118 # from the name, e.g. c1-3 take c1-3
1219 hostname = socket .gethostbyaddr (os .environ ["REMOTE_ADDR" ])[0 ].split ("." )[0 ]
1320
14- os .remove ("/var/www/provision/reinstall/" + hostname )
21+ try :
22+ os .remove ("/var/www/provision/reinstall/" + hostname )
23+ except OSError as e :
24+ syslog .syslog (syslog .LOG_INFO , str (e ))
25+ pxe_abort ()
26+
1527 with open ('/var/www/provision/nodes/pxe_nodes.json' ) as f :
1628 j = json .load (f )
1729 nodesettings = j [hostname ]
2537 print "initrd http://" + nodesettings ["kickstart_server_ip" ] + "/ks/initrd.img"
2638 print "boot"
2739
28- except :
29- print "#!ipxe"
30- print "exit"
40+ except Exception as e :
41+ syslog . syslog ( syslog . LOG_ERR , str ( e ))
42+ pxe_abort ()
You can’t perform that action at this time.
0 commit comments