Execute RT CLI on a foreign machine (XP)?

Hello All,

what would I need to do to run the RT CLI on my software development machine
(WinXP) against a RT-Installation on a Linux Server?
What files do I need to copy/install on my machine?
How would I handle the login to RT?

I have already installed Perl, but I assume that is not enough.
RT version in use is 3.6.5, Linux is Ubuntu 8.

Idea is to easily code a ticket data aggregation (for later reporting) by
using the CLI to get the number of tickets.
Or is there any better way to get access? If this doesn’t work I would use
direct SQL on the DB, but from the mailings in this list I understood that
using TicketSQL is preferred.

Thanks for any help!

Kai

View this message in context: http://www.nabble.com/Execute-RT-CLI-on-a-foreign-machine-(XP)--tp20015700p20015700.html

cygwin + perl + rtshell?

you could end up writing to output to a file on your XP box’s filesystem if i’m not mistaken…

-gabe-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com]On Behalf Of kschmitte
Sent: Thursday, October 16, 2008 10:31 AM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Execute RT CLI on a foreign machine (XP)?

Hello All,

what would I need to do to run the RT CLI on my software development machine
(WinXP) against a RT-Installation on a Linux Server?
What files do I need to copy/install on my machine?
How would I handle the login to RT?

I have already installed Perl, but I assume that is not enough.
RT version in use is 3.6.5, Linux is Ubuntu 8.

Idea is to easily code a ticket data aggregation (for later reporting) by
using the CLI to get the number of tickets.
Or is there any better way to get access? If this doesn’t work I would use
direct SQL on the DB, but from the mailings in this list I understood that
using TicketSQL is preferred.

Thanks for any help!

Kai

View this message in context: http://www.nabble.com/Execute-RT-CLI-on-a-foreign-machine-(XP)--tp20015700p20015700.html

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Hello Gabriel,

thanks for that hint.
But - in this case I would need to really learn Perl (what is on my Agenda,
but there is too less time…) and maybe also how to work with cygwin (where
I also have no clue).

My idea was to run a Python script (what I know very well) and to execute
the RT-CLI as a system-command.

Is there no way to take a few files from RT, change some setting for the
connection and go ahead?

Thanks,

Kai

View this message in context: http://www.nabble.com/Execute-RT-CLI-on-a-foreign-machine-(XP)--tp20015700p20094272.html

Hello All,

in case someone is interested :wink:
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 :wink: ):

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-(XP)--tp20015700p20421527.html