From: Stephen Soltesz <soltesz@cs.princeton.edu>
Date: Mon, 22 Jun 2009 18:18:06 +0000 (+0000)
Subject: allow deployment-specific settings in rtinit.d/*.pl
X-Git-Tag: Monitor-3.0-18~28
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=d873128643e0ba87ed0a688b9acde25d490ad520;p=monitor.git

allow deployment-specific settings in rtinit.d/*.pl
---

diff --git a/rt3/initialdata b/rt3/initialdata
index 1c34542..3c3db8c 100644
--- a/rt3/initialdata
+++ b/rt3/initialdata
@@ -233,38 +233,6 @@
       Name        => 'Blank',                                             # loc
       Description => 'A blank template',                                  # loc
       Content     => '', },
-    {  Queue       => '0',
-       Name        => 'Autoreply',                                         # loc
-       Description => 'Default Autoresponse template',                     # loc
-       Content     => 'Subject: AutoReply: {$Ticket->Subject}
-
-Hello,
-
-Thank you very much for reporting this.
-
-This message was automatically generated in response to the
-creation of a trouble ticket regarding:
-
-	"{$Ticket->Subject()}"
-
-There is no need to reply to this message right now.  Your ticket has been
-assigned an ID of [{$rtname} #{$Ticket->id()}].
-
-Please include the string:
-
-    [{$rtname} #{$Ticket->id}]
-
-in the subject line of all future correspondence about this issue. To do so, 
-you may reply to this message.
-
-Thank you,
-{$Ticket->QueueObj->CorrespondAddress()}
-{$Ticket->AddCustomFieldValue(Field => 'Problem Category', Value => 'Trivial');}
-
--------------------------------------------------------------------------
-{$Transaction->Content()}
-'
-    },
 
     {  Queue       => '0',
        Name        => 'Transaction',                     # loc
@@ -352,7 +320,7 @@ further questions or concerns, please respond to this message.
       Description => 'Message with the recipients in the header',          # loc
       Content     => 'RT-Attach-Message: yes
 
-Email Recipients (see http://PLC_RT_HOSTNAME/rt3/Ticket/Display.html?id={$Ticket->id})
+Email Recipients (see http://PLC_RT_HOSTNAME/rt3/Ticket/Display.html?id={$Ticket->id} )
     Owner: {$Ticket->OwnerObj->Name}
     Requestor: {$Ticket->RequestorAddresses}
 { if ($acc=$Ticket->AdminCcAddresses) { "    Ticket Ccs: " . $acc } }
@@ -367,7 +335,7 @@ Email Recipients (see http://PLC_RT_HOSTNAME/rt3/Ticket/Display.html?id={$Ticket
       Description => 'Create with CC in body',                 # loc
       Content     => 'RT-Attach-Message: yes
 
-Email Recipients (see http://PLC_RT_HOSTNAME/rt3/Ticket/Display.html?id={$Ticket->id})
+Email Recipients (see http://PLC_RT_HOSTNAME/rt3/Ticket/Display.html?id={$Ticket->id} )
     Owner: {$Ticket->OwnerObj->Name}
     Requestor: {$Ticket->RequestorAddresses}
 { if ($acc=$Ticket->AdminCcAddresses) { "    Ticket Ccs: " . $acc } }
@@ -468,9 +436,6 @@ Your ticket has been rejected by { eval { $Approval->OwnerObj->Name } }.
     {  ScripCondition => 'On Resolve',
        ScripAction    => 'Notify Requestors',
        Template       => 'Resolved' },
-	#On Create Autoreply To Requestors with template Autoreply
-	#On Correspond Notify Requestors, Ccs and AdminCcs with template correspondance with CC
-	#On Create Notify AdminCcs with template Create with CC in body
 
     {  ScripCondition => 'On Create',
        ScripAction    => 'Notify AdminCcs',
@@ -646,6 +611,7 @@ return 0; # ignore $passed;
 
     { UserId => 'root',        # - principalid
       Right  => 'SuperUser', },
+	
 
 );
 
diff --git a/rt3/monitor-rt3.init b/rt3/monitor-rt3.init
index c7e8299..ee1020a 100644
--- a/rt3/monitor-rt3.init
+++ b/rt3/monitor-rt3.init
@@ -76,6 +76,8 @@ function check_rt_siteconfig ()
 		# copy to live configuration
 		cp -f $tmp_siteconfig /etc/rt3/RT_SiteConfig.pm 
 		cp -f $tmp_initialdata /etc/rt3/initialdata 
+		chmod 644 /etc/rt3/RT_SiteConfig.pm 
+		chmod 644 /etc/rt3/initialdata 
 
 		rm -f $tmp_siteconfig
 		rm -f $tmp_initialdata
@@ -92,6 +94,7 @@ function check_rt_pghba ()
 	if ! grep -q "$PATTERN" $CONF ; then
 		#### SETUP ACCESS from postgres user to run init for the first time.
 		echo "$PATTERN" >> $CONF
+		WROTE_PG_CONFIG="true"
 	fi
 
 }
@@ -119,6 +122,9 @@ function check_rt_init ()
 {
 	if [ ! -f /etc/rt3/setup.finished ] ; then
 		/usr/sbin/rt-setup-database --action init --dba postgres
+		for f in $MONITORPATH/rt3/rtinit.d/*.pl ; do 
+			/usr/sbin/rt-setup-database --action insert --dba postgres --datafile $f
+		done
 		touch /etc/rt3/setup.finished
 
 	###Last DB adjustments
@@ -238,6 +244,7 @@ case "$1" in
 		rm -f /etc/rt3/setup.finished
 
 		sed -i -e "s/Port=smtp, Name=MTA/Port=smtp,Addr=127.0.0.1, Name=MTA/g" /etc/mail/sendmail.mc
+		service plc start httpd
 
 		result "$MESSAGE"
 	;;
diff --git a/rt3/rtinit.d/planetlab.pl b/rt3/rtinit.d/planetlab.pl
new file mode 100644
index 0000000..b6db92d
--- /dev/null
+++ b/rt3/rtinit.d/planetlab.pl
@@ -0,0 +1,63 @@
+
+@ACL = (
+	{ GroupDomain => 'SystemInternal',
+	  GroupType => 'Everyone',
+	  Right => 'CreateTicket', },
+
+	{ GroupDomain => 'SystemInternal',
+	  GroupType => 'Everyone',
+	  Right => 'ReplyToTicket', },
+
+	{ GroupDomain => 'RT::System-Role',
+	  GroupType => 'AdminCc',
+	  Right => 'WatchAsAdminCc', },
+	  
+	{ GroupDomain => 'RT::System-Role',
+	  GroupType => 'Cc',
+	  Right => 'ReplyToTicket', },
+
+	{ GroupDomain => 'RT::System-Role',
+	  GroupType => 'Cc',
+	  Right => 'Watch', },
+
+	{ GroupDomain => 'RT::System-Role',
+	  GroupType => 'Owner',
+	  Right => 'ReplyToTicket', },
+
+	{ GroupDomain => 'RT::System-Role',
+	  GroupType => 'Owner',
+	  Right => 'ModifyTicket', },
+)
+@Templates = (
+    {  Queue       => '0',
+       Name        => 'Autoreply',                                         # loc
+       Description => 'Default Autoresponse template',                     # loc
+       Content     => 'Subject: AutoReply: {$Ticket->Subject}
+
+Hello,
+
+Thank you very much for reporting this.
+
+This message was automatically generated in response to the
+creation of a trouble ticket regarding:
+
+	"{$Ticket->Subject()}"
+
+There is no need to reply to this message right now.  Your ticket has been
+assigned an ID of [{$rtname} #{$Ticket->id()}].
+
+Please include the string:
+
+    [{$rtname} #{$Ticket->id}]
+
+in the subject line of all future correspondence about this issue. To do so, 
+you may reply to this message.
+
+Thank you,
+{$Ticket->QueueObj->CorrespondAddress()}
+
+-------------------------------------------------------------------------
+{$Transaction->Content()}
+'
+    },
+)