#!/usr/bin/python

import sys

from ltsp import ltsconfparser
from ltsp import ltsconfdict
from ltsp import ltspstatus
from ltsp import dhcpparser

# read existing config
data,idx=ltsconfparser.read('/opt/ltsp/i386/usr/share/doc/ltsp-client/examples/lts.conf')

# write new config
ltsconfparser.write('./lts.conf', data, idx)

print './lts.conf written\n'

# get stati of servers
print 'tftp: '+str(ltspstatus.tftp())
print 'nfs: '+str(ltspstatus.nfs())
print 'dhcp: '+str(ltspstatus.dhcp())
print 'ldm info: '+str(ltspstatus.ldminfo())
print 'network swap: '+str(ltspstatus.nbdswap())

# list dictionary options
print ltsconfdict.keymaps('/opt/ltsp/i386')
print ltsconfdict.kbmodels('/opt/ltsp/i386')
print ltsconfdict.videodrivers('/opt/ltsp/i386')
print ltsconfdict.serproto('/opt/ltsp/i386')
if len(sys.argv) > 1:
    print sys.argv[1]+' valid : '+str(ltsconfdict.validate(sys.argv[1]))
    print sys.argv[1]+' boolean : '+str(ltsconfdict.isboolean(sys.argv[1]))

# read /etc/ltsp/dhcpd.conf
print dhcpparser.read()


