>From 964a7164a5355153dd4acc00675421a6d2d641d8 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru@redhat.com>
Date: Thu, 18 Apr 2013 10:24:26 -0400
Subject: [PATCH] Minor fixes in a few configuration UI panels of RA and TPS.

Changed the status check and restart commands to systemctl.
The text $errorString will not be seen when the security domain login panel
is launched for the first time.

Ticket #452
---
 .../com/netscape/cms/servlet/csadmin/SecurityDomainLogin.java  |    1 +
 base/ra/apache/docroot/ra/admin/console/config/donepanel.vm    |    2 +-
 .../docroot/ra/admin/console/config/securitydomainpanel.vm     |    2 +-
 base/ra/lib/perl/PKI/RA/DonePanel.pm                           |    3 ++-
 base/ra/lib/perl/PKI/RA/SecurityDomainPanel.pm                 |    5 +++--
 base/tps/apache/docroot/tps/admin/console/config/donepanel.vm  |    8 +-------
 .../docroot/tps/admin/console/config/securitydomainpanel.vm    |    2 +-
 base/tps/lib/perl/PKI/TPS/DonePanel.pm                         |    3 ++-
 base/tps/lib/perl/PKI/TPS/SecurityDomainPanel.pm               |    5 +++--
 9 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainLogin.java b/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainLogin.java
index 42165b08f3daabc902ae04eb1d2da65e1c4997d2..ed242f6913e70dca9a66c4ca1d7afc51d2e3bf5b 100644
--- a/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainLogin.java
+++ b/base/common/src/com/netscape/cms/servlet/csadmin/SecurityDomainLogin.java
@@ -67,6 +67,7 @@ public class SecurityDomainLogin extends BaseServlet {
             context.put("sd_pwd", "");
             context.put("url", url);
             context.put("host", u.getHost());
+            context.put("errorString", "");
             context.put("sdhost", CMS.getEESSLHost());
             if (subsystem.equals("KRA")) {
                 subsystem = "DRM";
diff --git a/base/ra/apache/docroot/ra/admin/console/config/donepanel.vm b/base/ra/apache/docroot/ra/admin/console/config/donepanel.vm
index 86e4068ea343d3078384df8e43d3657095d2da2d..b986701b929fd20cce6d2a2ea259940cf9e52bc5 100644
--- a/base/ra/apache/docroot/ra/admin/console/config/donepanel.vm
+++ b/base/ra/apache/docroot/ra/admin/console/config/donepanel.vm
@@ -33,7 +33,7 @@ function performPanel() {
 <img src="/pki/images/icon_crit_update.gif">&nbsp;<font color="red">$errorString</font>
 #end
 As 'root', restart the server on the command line by typing "$initCommand
- restart $instanceID". After performing this restart, the server should become operational.
+ restart $initDaemon@$instanceID .service". After performing this restart, the server should become operational.
 <br/>
 Please go to the <A href="https://$host:$non_clientauth_port"><b>services page</b></A> to access all of the available interfaces.
 <br/>
diff --git a/base/ra/apache/docroot/ra/admin/console/config/securitydomainpanel.vm b/base/ra/apache/docroot/ra/admin/console/config/securitydomainpanel.vm
index f67f7b2424f9414d119ea00f5df4fa87e97af319..9bd30bbbb97454c206d060d9174b3259014ad336 100644
--- a/base/ra/apache/docroot/ra/admin/console/config/securitydomainpanel.vm
+++ b/base/ra/apache/docroot/ra/admin/console/config/securitydomainpanel.vm
@@ -109,7 +109,7 @@ Enter the URL to an existing security domain.
 <table>
 <tr>
 <td valign="top"><b>NOTE:&nbsp;&nbsp; </b></td>
-<td>Since a Security Domain MUST be a CA (although all CAs are NOT necessarily Security Domains), an appropriate value for this URL may be obtained by logging into the machine which hosts the desired Security Domain CA as 'root' and running the command "$initCommand status $instanceID" from the command-line.</td>
+<td>Since a Security Domain MUST be a CA (although all CAs are NOT necessarily Security Domains), an appropriate value for this URL may be obtained by logging into the machine which hosts the desired Security Domain CA as 'root' and running the command "$initCommand status $initDaemon@$instanceID .service" from the command-line.</td>
 </tr>
 </table>
 <br/>
diff --git a/base/ra/lib/perl/PKI/RA/DonePanel.pm b/base/ra/lib/perl/PKI/RA/DonePanel.pm
index 4a32a8270ea92d05ecb845cde36dda66372407bd..c32b26ae4dcf9469f059312f62cd1bbb86ed3185 100755
--- a/base/ra/lib/perl/PKI/RA/DonePanel.pm
+++ b/base/ra/lib/perl/PKI/RA/DonePanel.pm
@@ -369,7 +369,7 @@ sub display
     my $initDaemon = "pki-rad";
     my $initCommand = "";
     if( $^O eq "linux" ) {
-        $initCommand = "/sbin/service $initDaemon";
+        $initCommand = "systemctl ";
     } else {
         ## default case:  e. g. - ( $^O eq "solaris" )
         $initCommand  = "/etc/init.d/$initDaemon";
@@ -379,6 +379,7 @@ sub display
     $::symbol{unsecurePort}  = $unsecurePort;
     $::symbol{port}  = $securePort;
     $::symbol{non_clientauth_port}  = $non_clientauth_securePort;
+    $::symbol{initDaemon} = $initDaemon;
     $::symbol{initCommand}  = $initCommand;
     $::symbol{instanceID}  = $instanceID;
 
diff --git a/base/ra/lib/perl/PKI/RA/SecurityDomainPanel.pm b/base/ra/lib/perl/PKI/RA/SecurityDomainPanel.pm
index 114b19ef0c0a16e6906e332801249ef5d9dad730..821548c5169000bdf9fa82c478f729b7d4051b38 100755
--- a/base/ra/lib/perl/PKI/RA/SecurityDomainPanel.pm
+++ b/base/ra/lib/perl/PKI/RA/SecurityDomainPanel.pm
@@ -134,15 +134,16 @@ sub display
     $::symbol{sdomainAdminURL} = "https://" . $hostname . ":"
                                . $default_https_admin_port;
 
-    my $initDaemon = "pki-cad";
+    my $initDaemon = "pki-tomcatd";
     my $initCommand = "";
     my $instanceID ="&lt;security_domain_instance_name&gt; ";
     if( $^O eq "linux" ) {
-        $initCommand = "/sbin/service $initDaemon";
+        $initCommand = "systemctl ";
     } else {
         ## default case:  e. g. - ( $^O eq "solaris" )
         $initCommand  = "/etc/init.d/$initDaemon";
     }
+    $::symbol{initDaemon} = $initDaemon;
     $::symbol{initCommand} = $initCommand;
     $::symbol{instanceID} = $instanceID;
     return 1;
diff --git a/base/tps/apache/docroot/tps/admin/console/config/donepanel.vm b/base/tps/apache/docroot/tps/admin/console/config/donepanel.vm
index 2aa76ff0c8cb874330f1e5a36e2eaad44acf4133..cbd7e4e896e0aca8cf62bbe7955ef1cdb40fe9dd 100644
--- a/base/tps/apache/docroot/tps/admin/console/config/donepanel.vm
+++ b/base/tps/apache/docroot/tps/admin/console/config/donepanel.vm
@@ -31,14 +31,8 @@ function performPanel() {
 #if ($errorString != "")
 <img src="/pki/images/icon_crit_update.gif">&nbsp;<font color="red">$errorString</font>
 #end
-#if ($systemType == "tks")
-As 'root', restart the server on the command line by typing "$initCommand restart $instanceID". After performing this restart, the server should become operational. 
-#else
-#if ($externalCA == "true" && $systemType == "kra")
-As 'root', restart the server on the command line by typing "$initCommand restart $instanceID". Startup the administration console to add the peer CA to the Trusted Manager's Group. Make sure to add the transport certificate and connector information to the peer CA. After performing this restart, the server should become operational.
-#else
 As 'root', restart the server on the command line by typing "$initCommand
- restart $instanceID". After performing this restart, the server should become operational.
+ restart $initDaemon@$instanceID .service". After performing this restart, the server should become operational.
 <br/>
 Please go to the <A href="https://$host:$non_clientauth_port">services page</A> to access all of the available interfaces.
 <br/>
diff --git a/base/tps/apache/docroot/tps/admin/console/config/securitydomainpanel.vm b/base/tps/apache/docroot/tps/admin/console/config/securitydomainpanel.vm
index 6f651f3885170490c03e4ccf303e7c69b2c317cb..0ce802a278dcb8fc95174f52ad822e4a20cefea5 100644
--- a/base/tps/apache/docroot/tps/admin/console/config/securitydomainpanel.vm
+++ b/base/tps/apache/docroot/tps/admin/console/config/securitydomainpanel.vm
@@ -108,7 +108,7 @@ Enter the URL to an existing security domain.
 <table>
 <tr>
 <td valign="top"><b>NOTE:&nbsp;&nbsp; </b></td>
-<td>Since a Security Domain MUST be a CA (although all CAs are NOT necessarily Security Domains), an appropriate value for this URL may be obtained by logging into the machine which hosts the desired Security Domain CA as 'root' and running the command "$initCommand status $instanceID" from the command-line.</td>
+<td>Since a Security Domain MUST be a CA (although all CAs are NOT necessarily Security Domains), an appropriate value for this URL may be obtained by logging into the machine which hosts the desired Security Domain CA as 'root' and running the command "$initCommand status $initDaemon@$instanceID .service" from the command-line.</td>
 </tr>
 </table>
 <br/>
diff --git a/base/tps/lib/perl/PKI/TPS/DonePanel.pm b/base/tps/lib/perl/PKI/TPS/DonePanel.pm
index 3d897fca994fdfd48625e8c86b0b5e7da55dd830..f487afb2d36643b8c8de0bd98bb787bb50266ade 100755
--- a/base/tps/lib/perl/PKI/TPS/DonePanel.pm
+++ b/base/tps/lib/perl/PKI/TPS/DonePanel.pm
@@ -403,7 +403,7 @@ sub display
     my $initDaemon = "pki-tpsd";
     my $initCommand = "";
     if( $^O eq "linux" ) {
-        $initCommand = "/sbin/service $initDaemon";
+        $initCommand = "systemctl ";
     } else {
         ## default case:  e. g. - ( $^O eq "solaris" )
         $initCommand  = "/etc/init.d/$initDaemon";
@@ -413,6 +413,7 @@ sub display
     $::symbol{unsecurePort}  = $unsecurePort;
     $::symbol{port}  = $securePort;
     $::symbol{non_clientauth_port}  = $non_clientauth_securePort;
+    $::symbol{initDaemon} = $initDaemon;
     $::symbol{initCommand}  = $initCommand;
     $::symbol{instanceID}  = $instanceID;
 
diff --git a/base/tps/lib/perl/PKI/TPS/SecurityDomainPanel.pm b/base/tps/lib/perl/PKI/TPS/SecurityDomainPanel.pm
index 5301d13693ecd835577dd2b4b0073fc37901b662..700089980d7a1ad092b18897d5331bede66e7c5a 100755
--- a/base/tps/lib/perl/PKI/TPS/SecurityDomainPanel.pm
+++ b/base/tps/lib/perl/PKI/TPS/SecurityDomainPanel.pm
@@ -133,15 +133,16 @@ sub display
     $::symbol{sdomainAdminURL} = "https://" . $hostname . ":"
                                . $default_https_admin_port;
 
-    my $initDaemon = "pki-cad";
+    my $initDaemon = "pki-tomcatd";
     my $initCommand = "";
     my $instanceID = "&lt;security_domain_instance_name&gt; ";
     if( $^O eq "linux" ) {
-        $initCommand = "/sbin/service $initDaemon";
+        $initCommand = "systemctl ";
     } else {
         ## default case:  e. g. - ( $^O eq "solaris" )
         $initCommand  = "/etc/init.d/$initDaemon";
     }
+    $::symbol{initDaemon} = $initDaemon;
     $::symbol{initCommand} = $initCommand;
     $::symbol{instanceID}  = $instanceID;
     return 1;
-- 
1.7.10.2

