Skip to content

Commit

Permalink
BUGFIX: Import sys for the rare error path
Browse files Browse the repository at this point in the history
Also cleanup some dangling whitespace.
  • Loading branch information
marklandis authored and bsanders committed Jun 5, 2019
1 parent 3f72206 commit 23bb341
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/src/stack/pxeboot/setPxeboot.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import os
import cgi
import syslog
import json
import sys
import stack.api

syslog.openlog('setPxeBoot.cgi', syslog.LOG_PID, syslog.LOG_LOCAL0)
Expand All @@ -28,7 +29,7 @@ if 'REMOTE_ADDR' in os.environ:
ipaddr = os.environ['REMOTE_ADDR']
if not ipaddr:
sys.exit(-1)

syslog.syslog(syslog.LOG_INFO, 'remote addr %s' % ipaddr)

# 'params' field should be a python dictionary of the form:
Expand All @@ -54,7 +55,7 @@ try:
except:
syslog.syslog(syslog.LOG_ERR, 'missing params')


# The above let's us set the boot action to anything (e.g. 'install') but
# here we lock thing down to only allow a reset to 'os'.

Expand All @@ -66,7 +67,7 @@ if action == 'os':
'value=false'])
stack.api.Call('set host attr', [ ipaddr, 'attr=secureerase',
'value=false'])

print('Content-type: application/octet-stream')
print('Content-length: %d' % (len('')))
print('')
Expand Down

0 comments on commit 23bb341

Please sign in to comment.