From 2d8ce79bf0dedf6f541e14dc70a2362df311ee67 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 6 Feb 2008 17:19:13 +0000 Subject: [PATCH] Change logic of isServiceNode. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@403 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Utils.pm | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/Utils.pm b/perl-xCAT-2.0/xCAT/Utils.pm index 77e95f035..95ec13f4d 100644 --- a/perl-xCAT-2.0/xCAT/Utils.pm +++ b/perl-xCAT-2.0/xCAT/Utils.pm @@ -963,15 +963,13 @@ sub cpSSHFiles #------------------------------------------------------------------------------- =head3 isServiceNode - checks for the /etc/xCATSN.cfg file and if it exists - reads the MasterNodename:port. Caches the MasterNodename:port. - in the %::XCATMasterPort defined in the caller. + checks for the /etc/xCATSN.cfg file Arguments: none Returns: - MasterHostName:port, if it is a service node - return -1 - if not a service node + 1 - localHost is ServiceNode + 0 - localHost is not ServiceNode Globals: none Error: @@ -987,21 +985,12 @@ sub cpSSHFiles sub isServiceNode { my $value; - if (!(-e "/etc/xCATSN.cfg")) + if (-e "/etc/xCATSN.cfg") { - return -1; - } - if (exists($::XCATMasterPort{$value})) - { # already hash'd it - return $::XCATMasterPort{$value}; - } - - else - { # read the file - $::XCATMasterPort{$value} = `cat /etc/xCATSN.cfg`; - chomp $::XCATMasterPort{$value}; - return $::XCATMasterPort{$value}; - } + return 1; + } else { + return 0; + } } #-------------------------------------------------------------------------------