defect 2968792: add warning when the node name has capital for nodeadd, mkdef, chdef(only for new node)

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5572 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
daniceexi 2010-03-24 14:51:26 +00:00
parent 9d240074d9
commit c0b9d01cb3
2 changed files with 47 additions and 7 deletions

View File

@ -891,6 +891,19 @@ sub defmk
xCAT::MsgUtils->message("E", $rsp, $::callback);
&defmk_usage;
return 1;
} else {
my $invalidnodename = ();
foreach my $node (@::allobjnames) {
if ($node =~ /[A-Z]/) {
$invalidnodename .= ",$node";
}
}
if ($invalidnodename) {
$invalidnodename =~ s/,//;
my $rsp;
$rsp->{data}->[0] = "The node name \'$invalidnodename\' has capital which can not be resolved correctly by dns server. Please don't use the capital in the node name which need to be installed Operating System.";
xCAT::MsgUtils->message("W", $rsp, $::callback);
}
}
# set $objtype & fill in cmd line hash
@ -2090,14 +2103,30 @@ sub defch
xCAT::MsgUtils->message("I", $rsp, $::callback);
if (scalar(keys %newobjects) > 0)
{
my $newobj = join(',', sort(keys %newobjects));
my $rsp;
$rsp->{data}->[0] = "New object definitions \'$newobj\' have been created.";
xCAT::MsgUtils->message("I", $rsp, $::callback);
my $newobj = ();
my $invalidnodename = ();
foreach my $node (keys %newobjects) {
if ($node =~ /[A-Z]/) {
$invalidnodename .= ",$node";
}
$newobj .= ",$node";
}
if ($newobj) {
$newobj =~ s/,//;
my $rsp;
$rsp->{data}->[0] = "New object definitions \'$newobj\' have been created.";
xCAT::MsgUtils->message("I", $rsp, $::callback);
}
if ($invalidnodename) {
$invalidnodename =~ s/,//;
my $rsp;
$rsp->{data}->[0] = "The node name \'$invalidnodename\' has capital which can not be resolved correctly by dns server. Please don't use the capital in the node name which need to be installed Operating System.";
xCAT::MsgUtils->message("W", $rsp, $::callback);
}
}
}
}
return 0;
}
}

View File

@ -778,6 +778,17 @@ sub nodech
$callback->({error => "No noderange to add.\n",errorcode=>1});
return;
}
my $invalidnodename = ();
foreach my $node (@$nodes) {
if ($node =~ /[A-Z]/) {
$invalidnodename .= ",$node";
}
}
if ($invalidnodename) {
$invalidnodename =~ s/,//;
$callback->( {warning => "The node name \'$invalidnodename\' has capital which can not be resolved correctly by dns server. Please don't use the capital in the node name which need to be installed Operating System.\n"} );
}
} elsif ($groupmode) {
@groups = split /,/, shift @ARGV;
}