From dabc94af12ac8fd1639ead2004037ff8c217ad8b Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 20 Feb 2014 11:33:24 -0500 Subject: [PATCH] more code --- xCAT-server/lib/xcat/plugins/zone.pm | 34 +++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/zone.pm b/xCAT-server/lib/xcat/plugins/zone.pm index 91398d3a8..85c026448 100644 --- a/xCAT-server/lib/xcat/plugins/zone.pm +++ b/xCAT-server/lib/xcat/plugins/zone.pm @@ -141,6 +141,32 @@ sub process_request } else { $request->{zonename} = $ARGV[0]; } + # if -s entered must be yes/1 or no/0 + if ($options{'sshbetweennodes'}) { + if ($options{'sshbetweennodes'}=~ /^yes$/i || $options{'sshbetweennodes'} eq "1") { + $options{'sshbetweennodes'}= "yes"; + } else { + if ($options{'sshbetweennodes'}=~ /^no$/i || $options{'sshbetweennodes'} eq "0") { + $options{'sshbetweennodes'}= "no"; + } else { + my $rsp = {}; + $rsp->{error}->[0] = + "The input on the -s flag $options{'sshbetweennodes'} is not valid."; + xCAT::MsgUtils->message("E", $rsp, $callback); + exit 1; + } + } + } + + # check for site.sshbetweennodes attribute, put out a warning it will not be used as long + # as zones are defined in the zone table. + my @entries = xCAT::TableUtils->get_site_attribute("sshbetweennodes"); + if ($entries[0]) { + my $rsp = {}; + $rsp->{info}->[0] = + "The site table sshbetweennodes attribute is set to $entries[0]. It is not used when zones are defined. To get rid of this warning, remove the site table sshbetweennodes attribute."; + xCAT::MsgUtils->message("I", $rsp, $callback); + } # save input noderange if ($options{'noderange'}) { @@ -439,7 +465,13 @@ sub updatezonetable # now add the users zone my %tb_cols; - $tb_cols{sshkeydir} = $keydir; + $tb_cols{sshkeydir} = $keydir; # key directory + # set sshbetweennodes attribute from -s flag or default to yes + if ( $$options{'sshbetweennodes'}) { + $tb_cols{sshbetweennodes} = $$options{'sshbetweennodes'}; + } else { + $tb_cols{sshbetweennodes} = "yes"; + } my $zonename=$request->{zonename}; if ( $$options{'defaultzone'}) { # set the default # check to see if a default already defined