From 655a180ff7f1a602996a0627922c9f6dc6476422 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Sun, 13 Sep 2015 07:11:56 +0000 Subject: [PATCH] [xCAT-server]Add check for existing target names for `chdef -n` --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 2d8d3bf18..762712123 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -1842,6 +1842,14 @@ sub defch return 1; } + # Ensure that the target object doesn't exist + if (grep /^$::opt_n$/, @validnode) { + my $rsp; + push @{$rsp->{data}}, "Object $::opt_n already exists."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + return 1; + } + # Use the getobjdefs function to get a hash which including # all the records in the table that should be changed my %chnamehash = ();