[rt-users] Execute RT CLI on a foreign machine (XP)?
kschmitte
kschmitte at voiceobjects.com
Mon Nov 10 09:58:16 EST 2008
Hello All,
in case someone is interested ;)
I have installed Gnome&Eclipse&PyDev on my RT test machine to resolve
this...
My Python code to get tickets looks like the following (hope that helps in
some place ;) ):
import os
class RTCLI:
#global Vars
DEBUG = False
def __init__(self):
self.DEBUG = False
#login
def login(self, user, password, server):
# os.system('export RTUSER=')
# os.system('export RTPASSWD=')
# os.system('export RTSERVER=http://localhost/rt')
os.system('export RTUSER=' + user)
os.system('export RTPASSWD=' + password)
os.system('export RTSERVER=' + server)
#TODO: check successful login
def runTicketSQL(self, sql):
runStr = "rt list \"" + sql + "\""
retVal = os.popen(runStr)
return retVal
def getTicket(self, ticketNo):
ticketData = {}
cmdLine = "rt show ticket/" + ticketNo
res = os.popen(cmdLine)
for line in res:
#get first part (before colon)
prop = line[0:line.find(": ", 0)]
value = line[line.find(": ",0)+2:]
ticketData[prop] = value
return ticketData
def __getTicketNumbers(self, sqlResult):
ticketList = []
for line in sqlResult:#
#print line[0:line.find(":",0)]
ticketList.append(line[0:line.find(":",0)])
return ticketList
def getAllTickets(self, sqlResult):
#the collection
ticketCollection = {}
#get list of numbers
ticketList = self.__getTicketNumbers(sqlResult)
#get Ticket data
for ticketNo in ticketList:
ticketData = self.getTicket(ticketNo)
ticketCollection[ticketNo] = ticketData
return ticketCollection
--
View this message in context: http://www.nabble.com/Execute-RT-CLI-on-a-foreign-machine-%28XP%29--tp20015700p20421527.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.
More information about the rt-users
mailing list