cluster: RHEL4 - fence_scsi_test.pl: #500172 fence_scsi_test.pl does not check for sg_persist in the path

Marek Grác marx@fedoraproject.org
Mon May 11 13:54:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=b63ffcfd1b7259e4edb97c28e7566621db83f831
Commit:        b63ffcfd1b7259e4edb97c28e7566621db83f831
Parent:        9524f11fe7de62cdfdb02da6a8a51b013cfd84f8
Author:        Marek 'marx' Grac <mgrac@redhat.com>
AuthorDate:    Mon May 11 15:41:25 2009 +0200
Committer:     Marek 'marx' Grac <mgrac@redhat.com>
CommitterDate: Mon May 11 15:51:22 2009 +0200

fence_scsi_test.pl: #500172 fence_scsi_test.pl does not check for sg_persist in the path

---
 fence/agents/scsi/fence_scsi_test.pl |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/fence/agents/scsi/fence_scsi_test.pl b/fence/agents/scsi/fence_scsi_test.pl
index 35bea49..59e65f9 100755
--- a/fence/agents/scsi/fence_scsi_test.pl
+++ b/fence/agents/scsi/fence_scsi_test.pl
@@ -187,8 +187,23 @@ sub print_usage
     print "  -h     Help. Prints out this usage information.\n\n";
 }
 
+sub test_tools_path
+{
+    my $tool_name = "sg_persist";
+    
+    for my $path ( split /:/, $ENV{PATH} ) {
+        if ( -f "$path/$tool_name" && -x _ ) {
+          return;
+        }
+    }
+    
+    die "No $tool_name command available, please install the sg3_utils package.\n"
+}
+
 ### MAIN #######################################################################
 
+test_tools_path;
+
 if (getopts("cdhst:v") == 0)
 {
     print_usage;



More information about the Cluster-cvs mailing list