From e4bae78c422e5e59026b7cc1bd06d227bad81e6d Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 29 Oct 2008 15:19:57 +0000 Subject: [PATCH] fix -i option git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2410 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/SINV.pm | 63 ++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/perl-xCAT/xCAT/SINV.pm b/perl-xCAT/xCAT/SINV.pm index ebad41f71..b58e28776 100644 --- a/perl-xCAT/xCAT/SINV.pm +++ b/perl-xCAT/xCAT/SINV.pm @@ -337,16 +337,20 @@ sub parse_and_run_sinv } else { - if ($admintemplate eq "NO") # default the seed node - { # admin did not generate a template - if ($nodelist[0] ne "NO_NODE_RANGE") { - push @seed, $nodelist[0]; # assign first element as seed - $seednode = $nodelist[0]; - } else { # error cannot default - my $rsp = {}; - $rsp->{data}->[0] = "No template or seed node supplied and no noderange to chose a default.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback,1); - exit 1; + if ($admintemplate eq "NO") # default the seed node + { # admin did not generate a template + if ($nodelist[0] ne "NO_NODE_RANGE") + { + push @seed, $nodelist[0]; # assign first element as seed + $seednode = $nodelist[0]; + } + else + { # error cannot default + my $rsp = {}; + $rsp->{data}->[0] = + "No template or seed node supplied and no noderange to chose a default.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback, 1); + exit 1; } } } @@ -1067,6 +1071,18 @@ sub writereport { xCAT::MsgUtils->message("I", $rsp, $callback); } + if ($ignorefirsttemplate eq "YES") + { + my $rsp = {}; + $rsp->{data}->[0] = + "Ignore flag chosen, not reporting matches on first template.\n"; + print $::OUTPUT_FILE_HANDLE $rsp->{data}->[0]; + if ($::VERBOSE) + { + xCAT::MsgUtils->message("I", $rsp, $callback); + } + next; + } #print list of nodes @nodenames = @{$nodehash{$template}}; @@ -1074,27 +1090,14 @@ sub writereport { my @shortnodename = split(/\./, $nodename); push @nodearray, $shortnodename[0]; # build an array of the nodes - if ($ignorefirsttemplate ne "YES") - { # report first template - $rsp->{data}->[0] = "$shortnodename[0]\n"; - print $::OUTPUT_FILE_HANDLE $rsp->{data}->[0]; - if ($::VERBOSE) - { - xCAT::MsgUtils->message("I", $rsp, $callback); - } - } - else - { # do not report nodes on first template - $rsp->{data}->[0] = - "Not reporting matches on first template.\n"; - print $::OUTPUT_FILE_HANDLE $rsp->{data}->[0]; - if ($::VERBOSE) - { - xCAT::MsgUtils->message("I", $rsp, $callback); - } - $ignorefirsttemplate = "NO"; # reset for remaining templates + $rsp->{data}->[0] = "$shortnodename[0]\n"; + print $::OUTPUT_FILE_HANDLE $rsp->{data}->[0]; + if ($::VERBOSE) + { + xCAT::MsgUtils->message("I", $rsp, $callback); } } + $ignorefirsttemplate = "NO"; # reset for remaining templates } # @@ -1106,7 +1109,7 @@ sub writereport foreach my $dshnodename (@dshnodearray) { if ($dshnodename ne "NO_NODE_RANGE") - { # skip it + { # skip it my @shortdshnodename; my @shortnodename; chomp $dshnodename;