From 6de92a9ef178ce0a7bddd0f1086a6166b55f7212 Mon Sep 17 00:00:00 2001 From: nott Date: Thu, 11 Apr 2013 14:18:08 +0000 Subject: [PATCH] remove use of global variable DELNODE git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15950 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/hosts.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index 4b7f755f9..b825a55e4 100644 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -216,6 +216,7 @@ sub process_request my $HELP; my $REMOVE; + my $DELNODE; # parse the options if ($req && $req->{arg}) { @ARGV = @{$req->{arg}}; } @@ -226,7 +227,7 @@ sub process_request !GetOptions( 'h|help' => \$HELP, 'n' => \$REMOVE, - 'd' => \$::DELNODE, + 'd' => \$DELNODE, 'o|othernamesfirst' => \$OTHERNAMESFIRST, 'a|adddomaintohostnames' => \$ADDNAMES, 'm|mactolinklocal' => \$MACTOLINKLOCAL, @@ -334,7 +335,7 @@ sub process_request } } - if ($::DELNODE) + if ($DELNODE) { delnode $node, $linklocal, $node, $domain; } @@ -368,7 +369,7 @@ sub process_request } } - if ($::DELNODE) + if ($DELNODE) { delnode $ref->{node}, $ref->{ip}, $ref->{hostnames}, $domain; } @@ -387,11 +388,11 @@ sub process_request } # end else # do the other node nics - if any - &donics($req->{node}, $callback); + &donics($req->{node}, $callback, $DELNODE); } else { - if ($::DELNODE) + if ($DELNODE) { return; } @@ -422,7 +423,7 @@ sub process_request } # also do nics table - &donics(\@allnodes, $callback); + &donics(\@allnodes, $callback, $DELNODE); } writeout(); @@ -460,7 +461,7 @@ sub writeout Globals: Example: - my $rc = &donics(\@nodes, $callback); + my $rc = &donics(\@nodes, $callback, $DELNODE); Comments: none @@ -471,6 +472,7 @@ sub donics { my $nodes = shift; my $callback = shift; + my $delnode = shift; my @nodelist = @{$nodes}; @@ -673,7 +675,7 @@ sub donics next; } - if ($::DELNODE) + if ($delnode) { delnode $nichostname, $nicip, '', $nicdomain; }