From c54779640002d51cec30c4d09b195b4d562f24b8 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 8 Apr 2014 07:49:27 -0400 Subject: [PATCH] defect 4050 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 108 +++++++++++---------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 425074fac..a1bed54db 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -251,38 +251,6 @@ sub preprocess_updatenode $callback->($rsp); return; } - # Just generate mypostscripts file and get out - if ($::GENMYPOST) - { - my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts"); - if ($entries[0] ) { - $entries[0] =~ tr/a-z/A-Z/; - if ($entries[0] =~ /^(1|YES)$/ ) { - - my $notmpfiles=1; - my $nofiles=0; - xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles); - my $rsp = {}; - $rsp->{data}->[0] = "Generated new mypostscript files"; - $callback->($rsp); - } else { # not valid unless precreatemypostscripts enabled - my $rsp = {}; - $rsp->{error}->[0] = - "This option is only valid if site table precreatemypostscripts attribute is 1 or YES"; - $rsp->{errorcode}->[0] =1; - $callback->($rsp); - return ; - } - } else { # not in the site table - my $rsp = {}; - $rsp->{error}->[0] = - "This option is only valid if site table precreatemypostscripts attribute is 1 or YES"; - $rsp->{errorcode}->[0] =1; - $callback->($rsp); - return ; - } - return 0; - } # -c must work with -S for AIX node if ($::CMDLINE && !$::SWMAINTENANCE) @@ -967,27 +935,6 @@ sub updatenode } - #create each /tftpboot/mypostscript/mypostscript. for each node - # This first removes the old one if precreatemypostscripts =0 or undefined - # call create files but no tmp files - my $notmpfiles=1; - my $nofiles=0; - #my $nofiles=1; - xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles); - - # convert the hashes back to the way they were passed in - my $flatreq = xCAT::InstUtils->restore_request($request, $callback); - my $imgdefs; - my $updates; - if ($flatreq->{imagedef}) - { - $imgdefs = $flatreq->{imagedef}; - } - if ($flatreq->{updateinfo}) - { - $updates = $flatreq->{updateinfo}; - } - # get the NIM primary server name my $nimprime = xCAT::InstUtils->getnimprime(); chomp $nimprime; @@ -1000,6 +947,7 @@ sub updatenode 'A|updateallsw' => \$::ALLSW, 'c|cmdlineonly' => \$::CMDLINE, 'd=s' => \$::ALTSRC, + 'g|genmypost' => \$::GENMYPOST, 'h|help' => \$::HELP, 'v|version' => \$::VERSION, 'V|verbose' => \$::VERBOSE, @@ -1042,6 +990,60 @@ sub updatenode $::attrres{$attr} = $value; } } + # Just generate mypostscripts file and get out + if ($::GENMYPOST) + { + my @entries = xCAT::TableUtils->get_site_attribute("precreatemypostscripts"); + if ($entries[0] ) { + $entries[0] =~ tr/a-z/A-Z/; + if ($entries[0] =~ /^(1|YES)$/ ) { + + my $notmpfiles=1; + my $nofiles=0; + xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles); + my $rsp = {}; + $rsp->{data}->[0] = "Generated new mypostscript files"; + $callback->($rsp); + } else { # not valid unless precreatemypostscripts enabled + my $rsp = {}; + $rsp->{error}->[0] = + "This option is only valid if site table precreatemypostscripts attribute is 1 or YES"; + $rsp->{errorcode}->[0] =1; + $callback->($rsp); + return ; + } + } else { # not in the site table + my $rsp = {}; + $rsp->{error}->[0] = + "This option is only valid if site table precreatemypostscripts attribute is 1 or YES"; + $rsp->{errorcode}->[0] =1; + $callback->($rsp); + return ; + } + return 0; + } + + #create each /tftpboot/mypostscript/mypostscript. for each node + # This first removes the old one if precreatemypostscripts =0 or undefined + # call create files but no tmp files + my $notmpfiles=1; + my $nofiles=0; + #my $nofiles=1; + xCAT::Postage::create_mypostscript_or_not($request, $callback, $subreq,$notmpfiles,$nofiles); + + # convert the hashes back to the way they were passed in + my $flatreq = xCAT::InstUtils->restore_request($request, $callback); + my $imgdefs; + my $updates; + if ($flatreq->{imagedef}) + { + $imgdefs = $flatreq->{imagedef}; + } + if ($flatreq->{updateinfo}) + { + $updates = $flatreq->{updateinfo}; + } + # if not just using the -k flag, then set all nodes to syncing in # nodelist updatestatus for the other updatenode options if (!($::SECURITY)) {