def dbRecordSelect(selectinput): thisCfgDict = cfgparse_dm.opencfg(dbcfg,'SectionOne') adminVar = thisCfgDict['databaseuser'] adminPwd= thisCfgDict['databasepwd'] ivDBName = thisCfgDict['databasename'] #debug print " sanitizing input data" selectvalue1 = str(selectinput[0]) selectvalue1 = inputSani_dm.inputSanitizer(selectvalue1,'sqlval') selecttable = str(selectinput[1]) selecttable = inputSani_dm.inputSanitizer(selecttable,'sqlval') jointable = str(selectinput[2]) jointable = inputSani_dm.inputSanitizer(jointable,'sqlval') joinv1 = str(selectinput[3]) joinv1 = inputSani_dm.inputSanitizer(joinv1,'sqlval') joinv2 = str(selectinput[4]) joinv2 = inputSani_dm.inputSanitizer(joinv2,'sqlval') wherecol = str(selectinput[5]) wherecol = inputSani_dm.inputSanitizer(wherecol,'sqlval') whereval = str(selectinput[6]) whereval = inputSani_dm.inputSanitizer(whereval,'sqlval') #debug print "retrieving data" resultlist = [] try: dbcon = mdb.connect('localhost',adminVar,adminPwd,ivDBName) #print "connected" except mdb.Error, e: print e.args[0] sys.exit(1)
def getpathinfo(): thisCfgDict = cfgparse_dm.opencfg(sitecfg,'SectionThree') keydir = thisCfgDict['keybase'] clientdir = thisCfgDict['rpzbase'] acldir = thisCfgDict['aclbase'] tmpdir = thisCfgDict['dmtemp'] pathlist = [keydir,clientdir,acldir,tmpdir] return pathlist
def dbinsert(insertstr): thisCfgDict = cfgparse_dm.opencfg(dbcfg, "SectionOne") adminVar = thisCfgDict["databaseuser"] adminPwd = thisCfgDict["databasepwd"] ivDBName = thisCfgDict["databasename"] try: dbcon = mdb.connect("localhost", adminVar, adminPwd, ivDBName) # print "connected in insert function" except mdb.Error, e: print e.args[0] sys.exit(1)
def dbRecordSelect(selectinput): # print selectinput thisCfgDict = cfgparse_dm.opencfg(dbcfg, "SectionOne") adminVar = thisCfgDict["databaseuser"] adminPwd = thisCfgDict["databasepwd"] ivDBName = thisCfgDict["databasename"] print " retriving data" resultlist = [] try: dbcon = mdb.connect("localhost", adminVar, adminPwd, ivDBName) # print "connected" except mdb.Error, e: print e.args[0] sys.exit(1)
def dbRecordCheck(checkinput): thisCfgDict = cfgparse_dm.opencfg(dbcfg,'SectionOne') adminVar = thisCfgDict['databaseuser'] adminPwd= thisCfgDict['databasepwd'] ivDBName = thisCfgDict['databasename'] print "checking existing database records" # by default config parser converts keys to lowercase , https://docs.python.org/2/library/configparser.html checkcolumn = checkinput[0] checktable = checkinput[1] checkvalue = checkinput[2] var = False try: dbcon = mdb.connect('localhost',adminVar,adminPwd,ivDBName) #print "connected" except mdb.Error, e: print e.args[0] sys.exit(1)
def dbRecordSelect(selectinput): thisCfgDict = cfgparse_dm.opencfg(dbcfg,'SectionOne') adminVar = thisCfgDict['databaseuser'] adminPwd= thisCfgDict['databasepwd'] ivDBName = thisCfgDict['databasename'] print " retriving data" selectvalue = str(selectinput[0]) selecttable = str(selectinput[1]) selectcolumn = str(selectinput[2]) selectwhere = str(selectinput[3]) resultlist = [] try: dbcon = mdb.connect('localhost',adminVar,adminPwd,ivDBName) #print "connected" except mdb.Error, e: print e.args[0] sys.exit(1)
def getnodeinfo(): thisCfgDict = cfgparse_dm.opencfg(sitecfg,'SectionTwo') xferport = thisCfgDict['zonetransferport'] gviewdict['xfr_port']=xferport zonemstr = thisCfgDict['bindzonemaster'] gviewdict['bind_zone_master'] = zonemstr nodelist = thisCfgDict['recursivenameservers'].split(',') # clean up any spaces between the nodes rnodestr='' for i in range(len(nodelist)): rnodestr = rnodestr + nodelist[i].strip() + "," gviewdict['rec_nodes'] = rnodestr # Get the forwarders from the config file fwdnodes = thisCfgDict['recursiveforwarders'].split(',') rfwdstr='' for i in range(len(fwdnodes)): rfwdstr = rfwdstr + fwdnodes[i].strip() + "," gviewdict['rec_forwarders'] = rfwdstr return
def getAppOwnerInfo(): thisCfgDict = cfgparse_dm.opencfg(sitecfg,'SectionFour') dnsmgid = thisCfgDict['dmgid'] mbuid = thisCfgDict['aouid'] uinfo=[mbuid,dnsmgid] return uinfo