From c0b9d01cb3d29aeb48c329800feb7d2fe5ac0f73 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 24 Mar 2010 14:51:26 +0000 Subject: [PATCH] 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 --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 43 ++++++++++++++++---- xCAT-server/lib/xcat/plugins/tabutils.pm | 11 +++++ 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 41ae75076..43cd7c231 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -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; } } diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 923037d46..4d9d6b417 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -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; }