From bb0a253fb20deb512871c9017b4224a9db6f8d80 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 13 May 2008 12:36:13 +0000 Subject: [PATCH] fix isServiceRequired routine git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1362 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Utils.pm | 49 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/Utils.pm b/perl-xCAT-2.0/xCAT/Utils.pm index 4fdc92436..b5f5c789f 100644 --- a/perl-xCAT-2.0/xCAT/Utils.pm +++ b/perl-xCAT-2.0/xCAT/Utils.pm @@ -9,10 +9,9 @@ require Data::Dumper; require xCAT::NodeRange; require DBI; -our @ISA = qw(Exporter); +our @ISA = qw(Exporter); our @EXPORT_OK = qw(genpassword); - #-------------------------------------------------------------------------------- =head1 xCAT::Utils @@ -24,6 +23,7 @@ This program module file, is a set of utilities used by xCAT commands. =cut #-------------------------------------------------------------------------------- + =head3 genpassword returns a random string of specified length or 8 if none given Arguments: @@ -41,22 +41,23 @@ This program module file, is a set of utilities used by xCAT commands. =cut #-------------------------------------------------------------------------------- -sub genpassword { -#Generate a pseudo-random password of specified length - my $length = shift; - unless ($length) { $length = 8; } - my $password=''; - my $characters= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'; - srand; #have to reseed, rand is not rand otherwise - while (length($password) < $length) { - $password .= substr($characters,int(rand 63),1); +sub genpassword +{ + + #Generate a pseudo-random password of specified length + my $length = shift; + unless ($length) { $length = 8; } + my $password = ''; + my $characters = + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'; + srand; #have to reseed, rand is not rand otherwise + while (length($password) < $length) + { + $password .= substr($characters, int(rand 63), 1); } return $password; } - - - #-------------------------------------------------------------------------------- =head3 quote @@ -1624,14 +1625,17 @@ sub isServiceReq foreach my $node (@snodelist) { - if ($node->{$service}) - { # returns service, only if set - my $value = $node->{$service}; - $value =~ tr/a-z/A-Z/; # convert to upper - # value 1 or yes then we setup the service - if (($value == 1) || ($value eq "YES")) - { - return 1; # found service required for the node + if ($serviceip eq $node->{'node'}) + { # match table entry + if ($node->{$service}) + { # returns service, only if set + my $value = $node->{$service}; + $value =~ tr/a-z/A-Z/; # convert to upper + # value 1 or yes then we setup the service + if (($value == 1) || ($value eq "YES")) + { + return 1; # found service required for the node + } } } } @@ -2298,6 +2302,7 @@ sub getSNList return @servicenodes; } + #------------------------------------------------------------------------------- =head3 isMounted