Commit 942ee40a authored by Jesse Vincent's avatar Jesse Vincent
Browse files

rt.2.1

parent 176e5a01
......@@ -97,7 +97,7 @@ SYSTEM_BINARIES = $(DESTDIR)/$(RT_SBIN_PATH)/
# "Pg" is known to work
# "Oracle" is in the early stages of working.
DB_TYPE = `${GETPARAM} DatabaseName`
DB_TYPE = `${GETPARAM} DatabaseType`
# Set DBA to the name of a unix account with the proper permissions and
# environment to run your commandline SQL sbin
......@@ -247,6 +247,15 @@ config-install:
install -b -D -g $(RTGROUP) -o $(BIN_OWNER) etc/RT_Config.pm $(DESTDIR)/$(CONFIG_FILE_PATH)
@echo "Installed configuration. about to install rt in $(RT_PATH)"
test:
$(PERL) -Ilib lib/t/smoke.t
regression: regression-instruct dropdb initialize-database
(cd ./lib; $(PERL) Makefile.PL && make testifypods && $(PERL) t/regression.t)
regression-instruct:
@echo "About to wipe your database for a regression test. ABORT NOW with Control-C"
# {{{ database-installation
genschema:
......@@ -265,7 +274,7 @@ insert-schema:
$(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/initdb insert
insert-baseline-data:
$(DESTDIR)/$(RT_SBIN_PATH)/insertdata
$(PERL) $(DESTDIR)/$(RT_SBIN_PATH)/insertdata
# }}}
......@@ -339,6 +348,10 @@ bin-install:
$(BINARIES)
# }}}
factory: createdb insert-schema
cd lib; $(PERL) sbin/factory $(DB_DATABASE) RT
commit:
aegis -build ; aegis -diff ; aegis -test; aegis --development_end
......
......@@ -284,24 +284,6 @@ elsif (!defined($TicketId)) {
);
$RT::Logger->error("Create failed: $id / $Transaction / $ErrStr ");
}
else {
if ($values->{'keywords'}) {
foreach my $keywordsel (keys %{$values->{'keywords'}}) {
my $ks_obj = $Ticket->QueueObj->KeywordSelect($keywordsel);
next unless ($ks_obj->id);
foreach my $key (keys %{$values->{'keywords'}{$keywordsel}}) {
my $kids = $ks_obj->KeywordObj->Descendents;
foreach my $kid (keys %{$kids}) {
next unless ($kids->{$kid} =~ /^$key$/i);
my ($val, $msg) =
$Ticket->AddKeyword(KeywordSelect => $ks_obj->id,
Keyword => $kid);
}
}
}
}
}
}
# }}}
......@@ -668,50 +650,6 @@ sub ActOnPseudoHeaders {
}
}
# {{{ Deal with ticket keywords
else {
#Default is to add keywords
my $op = '+';
my $ks = $Ticket->QueueObj->KeywordSelect($command);
unless ($ks->Id) {
$ResultsMessage .= "ERROR: couldn't find a keyword ".
"selection matching '$command'\n";
next;
}
if ($args =~ /^(\-|\+)(.*)$/) {
$op = $1;
$args = $2;
}
my $kids = $ks->KeywordObj->Descendents;
#TODO: looping is lossy.
foreach my $kid (keys %{$kids}) {
next unless ($kids->{$kid} =~ /^$args$/i);
if ($op eq '-') {
($val, $msg) =
$Ticket->DeleteKeyword(KeywordSelect => $ks->id,
Keyword => $kid);
}
elsif ($op eq '+') {
($val, $msg) =
$Ticket->AddKeyword(KeywordSelect => $ks->id,
Keyword => $kid);
}
else {
$msg = "'$op' is not a valid operator.\n";
}
}
}
}
# }}}
$ResultsMessage .= $msg." succeeded\n";
}
......@@ -761,10 +699,6 @@ sub ParsePseudoHeadersForNewTicket {
# in this context
push @{$commandvalues{lc($command)}}, $args;
}
#Deal with keywords
else {
$commandvalues{'keywords'}{$command}{$args} = 1;
}
}
}
......
#!/bin/sh
DATABASEHOME=$1
HOSTNAME=$2
PORT=$3
DATABASEADMIN=$4
DBAPASSWD=$5
DATABASENAME=$6
DATABASEACLS=$7
BINDIR=${DATABASEHOME}/bin
echo "DBHOME = $DATABASEHOME"
echo "HOSTNAME = $HOSTNAME"
echo "PORT = $PORT"
echo "DATABASEADMIN = $DATABASEADMIN"
echo "DBAPASSWD = $DBAPASSWD"
echo "DATABASENAME = $DATABASENAME"
PATH=$PATH:$BINDIR
export PATH
echo "Please enter ${DATABASEADMIN}'s password for the SID ${DATABASENAME} to create an rt user";
$BINDIR/sqlplus ${DATABASEADMIN}@${DATABASENAME} @$DATABASEACLS
#!/bin/sh
DATABASEHOME=$1
HOSTNAME=$2
PORT=$3
DATABASEADMIN=$4
DBAPASSWD=$5
DATABASENAME=$6
DATABASEACLS=$7
BINDIR=${DATABASEHOME}/bin
PATH=$PATH:$BINDIR
export PATH
echo "Enter the postgres administrator's database password to create a new user for rt"
if [ "fnord$PORT" != "fnord" ]; then
PORT="-p $PORT"
fi;
if [ "fnord$HOSTNAME" != "fnord" ]; then
HOSTNAME="-h $HOSTNAME"
fi;
psql $HOSTNAME $PORT -d $DATABASENAME -f $DATABASEACLS -U $DATABASEADMIN
#!/bin/sh
DATABASEHOME=$1
HOSTNAME=$2
PORT=$3
DATABASEADMIN=$4
DBAPASSWD=$5
DATABASENAME=$6
DATABASEACLS=$7
BINDIR=${DATABASEHOME}/bin
PATH=$PATH:$BINDIR
export PATH
echo "Enter the mysql administrator's database password to create a new user for RT"
$BINDIR/mysql --host=${HOSTNAME} --port=${PORT} --user=${DATABASEADMIN} -p${DBAPASSWD} mysql < $DATABASEACLS
echo "Enter the mysql administrator's database password to nondestructively reload the database"
$BINDIR/mysqladmin --host=${HOSTNAME} --port=${PORT} --user=${DATABASEADMIN} -p${DBAPASSWD} reload
......@@ -57,12 +57,6 @@ use Carp;
use RT::Scrips;
use RT::Group;
use RT::Groups;
use RT::Keyword;
use RT::Keywords;
use RT::ObjectKeyword;
use RT::ObjectKeywords;
use RT::KeywordSelect;
use RT::KeywordSelects;
use RT::GroupMember;
use RT::GroupMembers;
use RT::Watcher;
......
......@@ -85,7 +85,6 @@ my ( @id,
@memberof,
@refersto,
$mergeinto,
@keywords,
$time_taken,
$verbose,
$debug,
......@@ -128,7 +127,6 @@ my @args =("id=s" => \@id,
"history|show" => \$history,
"summary:s" => \$summary,
"create" => \$create,
"keywords=s" => \@keywords,
"requestor|requestors=s" => \@requestors,
"cc=s" => \@cc,
"admincc=s" => \@admincc,
......@@ -166,7 +164,6 @@ my @args =("id=s" => \@id,
GetOptions(@args);
print join(':',@keywords);
# {{{ If they want it, print a usage message and get out
if ($help) {
......@@ -259,11 +256,6 @@ Attributes
(When creating tickets, just leave off the + or - )
Keywords
--keywords[+|-]<keyword_select>/<keyword>
Add or remove a keyword.
Dates
--due=<date>
......@@ -677,41 +669,6 @@ else {
# }}}
# {{{ Deal with ticket keywords
my $KeywordSelects = $Ticket->QueueObj->KeywordSelects();
$RT::Logger->debug ("Looking at keywords");
foreach $value (@keywords) {
$RT::Logger->debug("Looking at --keyword=$value");
if ($value =~ /^(\W?)(.*?)\/(.*)$/) {
my $op = $1;
my $select = $2;
my $keyword = $3;
$RT::Logger->debug("Going to $op Keyword $select / $keyword");
while (my $ks = $KeywordSelects->Next) {
$RT::Logger->debug("$select is select ".$ks->Name." is found");
next unless ($ks->Name =~ /$select/i);
$RT::Logger->debug ("Found a match for $select\n");
my $kids = $ks->KeywordObj->Descendents;
my ($kid);
foreach $kid (keys %{$kids}) {
$RT::Logger->debug("Now comparing $keyword with ".$kids->{$kid}. "\n");
next unless ($kids->{$kid} =~ /^$keyword$/i);
$RT::Logger->debug("Going to $op $select / $keyword (".$kids->{$kid} .")");
$Ticket->DeleteKeyword(KeywordSelect => $ks->id,
Keyword => $kid) if ($op eq '-');
$Ticket->AddKeyword(KeywordSelect => $ks->id,
Keyword => $kid) if ($op eq '+');
}
}
}
}
# }}}
# {{{ deal with links
# Deal with merging {
......@@ -1149,23 +1106,6 @@ Serial Number: @{[$Ticket->Id]} Status:@{[$Ticket->Status]} Worked: @{[$Ticket
EOFORM
my $selects = $Ticket->QueueObj->KeywordSelects();
#get the keyword selects
print "Keywords:\n";
while (my $select = $selects->Next) {
print "\t" .$select->Name .": ";
my $keys = $Ticket->KeywordsObj($select->id);
while (my $key = $keys->Next) {
print $key->KeywordObj->RelativePath($select->KeywordObj) . " ";
}
print "\n";
}
#iterate through the keyword selects.
#print the keyword select and all the related keywords
#TODO: finish link descriptions
print "Dependencies: \n";
......
......@@ -784,49 +784,6 @@ sub ActOnPseudoHeaders {
}
}
# {{{ Deal with ticket keywords
else {
#Default is to add keywords
my $op = '+';
my $ks = $Ticket->QueueObj->KeywordSelect($command);
unless ( $ks->Id ) {
$ResultsMessage .= "ERROR: couldn't find a keyword "
. "selection matching '$command'\n";
next;
}
if ( $args =~ /^(\-|\+)(.*)$/ ) {
$op = $1;
$args = $2;
}
my $kids = $ks->KeywordObj->Descendents;
#TODO: looping is lossy.
foreach my $kid ( keys %{$kids} ) {
next unless ( $kids->{$kid} =~ /^$args$/i );
if ( $op eq '-' ) {
( $val, $msg ) = $Ticket->DeleteKeyword(
KeywordSelect => $ks->id,
Keyword => $kid
);
}
elsif ( $op eq '+' ) {
( $val, $msg ) = $Ticket->AddKeyword(
KeywordSelect => $ks->id,
Keyword => $kid
);
}
else {
$msg = "'$op' is not a valid operator.\n";
}
}
}
}
# }}}
$ResultsMessage .= $msg . "\n";
}
......
......@@ -53,19 +53,6 @@ my $help_acl ="
# }}}
# {{{ help_keyword_sel
my $help_keyword_sel = "
Keyword Selections
--add-keyword-select
--modify-keyword-select <name>
--ks-name <name>
--ks-keyword <keyword>
--ks-single
--ks-multiple
--ks-depth <int>
--disable-keyword-select <name>";
# }}}
# {{{ help_scrip
my $help_scrip = "
......@@ -107,7 +94,6 @@ USAGE: rtadmin --user <userid> [Userflags]
rtadmin --group [groupflags]
rtadmin --list-groups
rtadmin --system [SystemFlags]
rtadmin --keyword [keywordflags]
User configuration for --user <userid>
......@@ -187,8 +173,6 @@ Queue Configuration for --queue <queueid>
$help_acl
$help_keyword_sel
$help_template
$help_scrip
......@@ -198,20 +182,11 @@ System configuration for --system
$help_acl
$help_keyword_sel
$help_template
$help_scrip
Keyword configuration for --keyword <fully qualified name>
--list-children
--create-child <name>
--disable
--name <new name>
--description <new description>
EOF
......@@ -223,7 +198,7 @@ EOF
# {{{ PickMode
sub PickMode {
my ($user,$group, $queue, $system, $keyword, $listusers,
my ($user,$group, $queue, $system, $listusers,
$listgroups, $listqueues, $help);
......@@ -232,7 +207,6 @@ sub PickMode {
'queue=s' => \$queue,
'group=s' => \$group,
'system' => \$system,
'keyword=s', => \$keyword,
'list-users' => \$listusers,
'list-queues' => \$listqueues,
'list-groups' => \$listgroups,
......@@ -244,7 +218,6 @@ sub PickMode {
elsif ($group) { AdminGroup($group) }
elsif ($queue) { AdminQueue($queue) }
elsif ($system) { AdminSystem($system) }
elsif ($keyword) { AdminKeywords($keyword) }
elsif ($listusers) { ListUsers() }
elsif ($listgroups) { ListGroups() }
elsif ($listqueues) { ListQueues() }
......@@ -469,7 +442,6 @@ sub AdminQueue {
AdminTemplates($queue_obj->Id());
AdminScrips($queue_obj->Id());
AdminRights($queue_obj->Id());
AdminKeywordSelects($queue_obj->Id());
#Check if we need to delete the queue
if ($args{'disable'}) {
......@@ -482,159 +454,6 @@ sub AdminQueue {
# }}}
# {{{ AdminKeywords
sub AdminKeywords {
my $keyword = shift;
my %args;
GetOptions(\%args, 'list-children', 'create-child=s', 'disable|delete', 'Name=s', 'Description=s');
use RT::Keyword;
my $key_obj = new RT::Keyword($CurrentUser);
my $key_id;
#If we're dealing with the root of the keyword list
if ($keyword eq '/') {
$key_id=0;
}
else {
my ($val, $msg) = $key_obj->LoadByPath( $keyword );
unless ($val) {
print $msg ."\n";
}
$key_id = $key_obj->Id();
}
if ($args{'create-child'}) {
my $child = new RT::Keyword($CurrentUser);
my ($val, $msg) = $child->Create( Parent => $key_id,
Name => $args{'create-child'},
);
print $msg ."\n";
}
elsif ($args{'list-children'}) {
my $keywords;
if ($key_obj->id) {
$keywords = $key_obj->Children();
}
#If we didn't actually have a keyword object, we need to create our own Keywords object.
else {
$keywords = new RT::Keywords($CurrentUser);
$keywords->LimitToParent(0);
}
while (my $key=$keywords->Next) {
print $key->Name;
if ($key->Description) {
print " (" . $key->Description .")";
}
print "\n";
}
}
#Else we wanna do some modification.
else {
#If we didn't load a keyword, get out
return(undef) unless ($key_obj->Id);
my @attributes = qw( Name Description );
foreach my $attrib (@attributes) {
if ( (exists ($args{"$attrib"})) and
($key_obj->$attrib() ne $args{"$attrib"})) {
my $method = "Set$attrib";
my ($val, $msg) = $key_obj->$method($args{"$attrib"});
print "Keyword ".$key_obj->Name. " $attrib: $msg\n"; }
}
if ($args{'disable'}) {
$key_obj->SetDisabled(1);
}
}
}
# }}}
# {{{ AdminKeywordSelects
sub AdminKeywordSelects {
my $queue = shift;
# O for queue means global
my %args;
GetOptions(\%args, 'add-keyword-select','disable-keyword-select|delete-keyword-select=s',
'modify-keyword-select=s',
'keyword-select-Keyword|ks-keyword=s',
'keyword-select-Single|ks-single',
'keyword-select-Multiple|ks-multiple',
'keyword-select-Depth|ks-depth=i',
'keyword-select-Name|ks-name=s'
);
# sanitize single vs multiple.
if ($args{'keyword-select-Multiple'}) {
$args{'keyword-select-Single'} = 0;
}
use RT::KeywordSelect;
my $keysel_obj = new RT::KeywordSelect($CurrentUser);
if ($args{'add-keyword-select'}) {
my ($val, $msg) = $keysel_obj->Create( Keyword => $args{'keyword-select-Keyword'},
Depth => $args{'keyword-select-Depth'},
Single => $args{'keyword-select-Single'},
Name => $args{'keyword-select-Name'},
ObjectType => 'Ticket',
ObjectField => 'Queue',
ObjectValue => $queue);
print $msg ."\n";
}
elsif ($args{'modify-keyword-select'}) {
$keysel_obj->LoadByName(Name => $args{'modify-keyword-select'},
Queue => $queue
);
unless ($keysel_obj->Id()) {
print "Keyword select not found\n";
return();
}
my @attributes = qw( Name Keyword Single Depth );
foreach my $attrib (@attributes) {
if ( (exists ($args{"keyword-select-$attrib"})) and
($keysel_obj->$attrib() ne $args{"keyword-select-$attrib"})) {
my $method = "Set$attrib";
my ($val, $msg) = $keysel_obj->$method($args{"keyword-select-$attrib"});
print "Keyword select ".$keysel_obj->Name. " $attrib: $msg\n"; }
}
}
elsif ($args{'disable-keyword-select'}) {
$keysel_obj->LoadByName(Name => $args{'disable-keyword-select'},
Queue => $queue);
$keysel_obj->SetDisabled(1);
}
}
# }}}
# {{{ AdminGroup
sub AdminGroup {
......@@ -720,12 +539,9 @@ sub AdminGroup {
# {{{ AdminSystem
sub AdminSystem {
print "In AdminSystem\n";
AdminTemplates(0);
AdminScrips(0);
AdminRights(0);
AdminKeywordSelects(0);
}
# }}}
......
......@@ -54,12 +54,6 @@ use Carp;
use RT::Scrips;
use RT::Group;
use RT::Groups;
use RT::Keyword;
use RT::Keywords;
use RT::ObjectKeyword;
use RT::ObjectKeywords;
use RT::KeywordSelect;
use RT::KeywordSelects;
use RT::GroupMember;
use RT::GroupMembers;
use RT::Watcher;
......