diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index e28bac035..46be7a395 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -4,6 +4,7 @@ use Text::Balanced qw/extract_bracketed/; require xCAT::Table; require Exporter; use strict; +use xCAT::MsgUtils; #Perl implementation of noderange our @ISA = qw(Exporter); @@ -293,6 +294,9 @@ sub expandatom { #my @grouplist = $grptab->getAllAttribs('groupname'); for my $row (@grplist) { if ($row->{groupname} eq $atom) { + my $rsp; + $rsp->{data}->[0] = "Could not create an object named \'$atom\' of type 'node'. A definition for a group object with the same name already exists."; + xCAT::MsgUtils->message("E", $rsp, $::callback); return (); } } diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle index a39991440..d1ef3de1e 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle @@ -151,6 +151,7 @@ mkdef_regex_nicsip mkdef_rhels73 mkdef_t_o_error mkdef_z +mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/rhels_x86_daily.bundle b/xCAT-test/autotest/bundle/rhels_x86_daily.bundle index 608e862ee..e4f886992 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_daily.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_daily.bundle @@ -151,6 +151,7 @@ mkdef_regex_nicsip mkdef_rhels73 mkdef_t_o_error mkdef_z +mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle b/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle index db5fb3832..dd1b0bad0 100644 --- a/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle +++ b/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle @@ -110,6 +110,7 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z +mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/sles_x86_daily.bundle b/xCAT-test/autotest/bundle/sles_x86_daily.bundle index 33c28f32a..dbe30b6e3 100644 --- a/xCAT-test/autotest/bundle/sles_x86_daily.bundle +++ b/xCAT-test/autotest/bundle/sles_x86_daily.bundle @@ -110,6 +110,7 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z +mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle b/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle index b0182265c..41ed0bcc5 100644 --- a/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle +++ b/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle @@ -79,6 +79,7 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z +mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle b/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle index 154c66025..c2f8b10d3 100644 --- a/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle +++ b/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle @@ -81,6 +81,7 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z +mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/testcase/mkdef/cases1 b/xCAT-test/autotest/testcase/mkdef/cases1 index 41c4b93c7..e0264c909 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases1 +++ b/xCAT-test/autotest/testcase/mkdef/cases1 @@ -150,3 +150,24 @@ check:rc==0 cmd:rmdef -t group -o xcattest_tmp_group_regex check:rc==0 end + +start:mkdef_nodename_hit_groupname +cmd:mkdef -t group -o tempgroup13579 +check:rc==0 +cmd:mkdef -t node -o tempgroup13579 groups=tempgroup13579 +check:rc==1 +check:output=~A definition for a group object with the same name already exists. +check:output=~No object names were provided +cmd:mkdef -t node -o tempgroup13579 groups=all +check:rc==1 +check:output=~A definition for a group object with the same name already exists. +check:output=~No object names were provided +cmd:mkdef -t node -o tempnode02468,tempgroup13579 groups=tempgroup13579 +check:rc==1 +check:output=~A definition for a group object with the same name already exists. +check:output=~1 object definitions have been created +cmd:rmdef -t node -o tempnode02468 +check:rc==0 +cmd:rmdef -t group -o tempgroup13579 +check:rc==0 +end