adric: books icon (c) 2004 adric.net (Default)
adric ([personal profile] adric) wrote2010-01-06 01:47 pm

Let's leverage RT's cli to create the test env by script

Some notes on the cli excerpted from my work on a build doc


RTDEBUG2 exported as a shell variable (eg export RTDEBUG=3 ) is handy for debugging RT cli tools. That helped me figure out that I should change a 1 to a 0 at 987,66 (line_num, char) in bin/rt to disable use of proxy environment variables so that requests for 127.0.0.1 don't go to squid pointlessly. That makes rt cli work. Then we can use a config file:

### .rtrc - Request Tracker 3.8.x rt cli configuration ###
server http://127.0.0.1:8888
user root
passwd password

##These specify defaults and more than one queue can be given (by adding a query expression)
##queue helpdesk or queue=support
##query Status != resolved and Owner=myaccount


or the RT env vars (both described in bin/rt help usage) and can wrangle RT internals without using WebUI or Perl, as needed.

Output of bin/rt , create -t queue -e:
# Required: Name

id: queue/new
Name:
Description:
CorrespondAddress:
CommentAddress:
InitialPriority:
FinalPriority:
DefaultDueIn:
, giving us this working recipe for programatically creating Queues:
bin/rt create -t queue set name=NewestQ description="a newer still Q than thee", allowing us to declare:


#!/usr/bin/ruby -w

## Example:
## bin/rt create -t queue set name=NewestQ description="a newer still Q than thee"

test_queues = [
{ :qname => 'External', :qdesc => 'External ticket Queue for Rt testenv' },
{ :qname => 'Helpdesk', :qdesc => 'Helpdesk ticket Queue for Rt testenv' },
{ :qname => 'Oversight', :qdesc => 'Oversight ticket Queue for Rt testenv' },
]

test_queues.each { |tq|
`bin/rt create -t queue set name=\"#{tq[:qname]}\" description=\"#{tq[:qdesc]}\"`
}


and we should easily be able to do the same for some sample users, groups. Unfortunately we can't add scrips or templates this way, yet.


2 http://www.gossamer-threads.com/lists/rt/users/61505?do=post_view_threaded

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org