[rt-users] Programmatically create queues

Karres, Dean karres at illinois.edu
Fri Sep 12 14:26:18 EDT 2014


Hi,

I am new to RT.  I have a test install of RT 4.2.6 on a RHEL 6.x platform.  It seems to work and I am newbie-lost in the universe of setting permissions -- but that is not currently my issue.

Our current helpdesk system has a bunch of queue-like things.  I don't want to have to click through the GUI to create them all.  I figured I would save time by writing a small script that could create them all quickly.  Apparently my newbie understanding of RT in general applies to trying to code scripts too.  I looked at the existing ...rt4/sbin/... scripts and the html RT module docs and came up with a one-liner (formatted over multi-lines for readability:

perl -e'	use lib qw(/opt/rt4/lib);
	use RT -init;
	use RT::Queue;
	use Data::Dumper;

	 my $queue = RT::Queue->new( RT->SystemUser );
	$queue->Load("Public Printing");
	$queue->Create({
		Name=>"WWW",
		Description=>"Web related issues",
		CorrespondAddress=>"",
		CommentAddress=>"",
		InitialPriority=>"0",
		FinalPriority=>"0",
		DefaultDueIn=>"0"
	});'

However, when I run it I get:

[27849] [Fri Sep 12 17:56:10 2014] [warning]: Odd number of elements in hash assignment at /opt/rt4/lib/RT/Queue.pm line 160. (/opt/rt4/lib/RT/Queue.pm:160)
[27849] [Fri Sep 12 17:56:10 2014] [warning]: Use of uninitialized value $name in length at /opt/rt4/lib/RT/Queue.pm line 317. (/opt/rt4/lib/RT/Queue.pm:317)

Looking in the /opt/rt4/lib/RT/Queue.pm file shows the "args" hash (line 160 in the 4.2.6 source) to have several more key tags available than the docs talk about.   Don't know if that is an issue.

What am I missing?  My guess is something trivial.

Dean...K...



More information about the rt-users mailing list