DLS configuration | '''
form = cgi.FieldStorage()
def getValue(form, name, default=''):
return len(form.getlist(name)) and form.getlist(name)[0] or default
hostname = getValue(form, 'hostname', 'dls')
domainname = getValue(form, 'domainname', 'nexedi.org')
connectiontype = getValue(form, 'connectiontype', 'dhcp')
networkdevice = getValue(form, 'networkdevice', 'eth0')
ipaddress = getValue(form, 'ipaddress')
netmask = getValue(form, 'netmask')
networkaddress = getValue(form, 'networkaddress')
broadcast = getValue(form, 'broadcast')
gateway = getValue(form, 'gateway')
nameserver1 = getValue(form, 'nameserver1')
nameserver2 = getValue(form, 'nameserver2')
wlanwepkey = getValue(form, 'wlanwepkey')
wlanessid = getValue(form, 'wlanessid')
wlanchannel = getValue(form, 'wlanchannel')
rootpassword = getValue(form, 'rootpassword')
webpassword = getValue(form, 'webpassword')
timezone = getValue(form, 'timezone', 'UTC')
systemlanguage = getValue(form, 'systemlanguage', 'en_US')
if len(nameserver1) != 0 :
if len(nameserver2) != 0 :
nameserver = '%s %s' % (nameserver1, nameserver2)
else :
nameserver = nameserver1
else :
nameserver = nameserver2
# debug information
#for key in form.keys():
#print key, form.getlist(key)
print "Creating config.xml file... "
try :
f = open("/tmp/config.xml",'w')
try :
f.write(xml_template % ("master", hostname, domainname, connectiontype, networkdevice, ipaddress, netmask, networkaddress, broadcast, gateway, nameserver, wlanwepkey, wlanessid, wlanchannel, networkaddress, netmask, timezone, systemlanguage, rootpassword, webpassword))
finally :
f.close()
executeCommand("sudo -u root /bin/cp -f /tmp/config.xml /home/dlsadmin/nexedi-dls/")
except IOError :
print "Unable to write /tmp/config.xml! "
raise
else :
print "Done. "
os.remove('/tmp/config.xml')
print """Now, please click here to finish the initial configuration. Note that this step can take several minutes to complete.""" % os.environ.get('HTTP_HOST', '127.0.0.1')
#footer
print ''' |
|