From f436cf68f3c513cd862c5613fe4d3c819d5adbe6 Mon Sep 17 00:00:00 2001 From: nott Date: Sat, 7 Jun 2008 16:30:09 +0000 Subject: [PATCH] Add mkdef error msg git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1607 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DBobjUtils.pm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 1c4c76621..54da73abc 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -668,7 +668,30 @@ sub setobjdefs # need to check the attrs we are setting for the object # as well as the attrs for this object that may be - # already set in DB + # already set in DB + + if ( !($objhash{$objname}{$check_attr}) && !($DBattrvals{$objname}{$check_attr}) ) { + # if I didn't already check for this attr + # if ($::VERBOSE) { + my $rsp; + if (!grep(/^$attr_name$/, @checkedattrs)) { + push @{$rsp->{data}}, "Cannot set the \'$attr_name\' attribute unless a value is provided for \'$check_attr\'.\n"; + + foreach my $tmp_attr (@{$datatype->{'attrs'}}) { + my $attr = $tmp_attr->{attr_name}; + if ($attr eq $check_attr) { + my ($tab, $at) = split(/\./, $tmp_attr->{tabentry}); + my $schema = xCAT::Table->getTableSchema($tab); + $desc = $schema->{descriptions}->{$at}; + push @{$rsp->{data}}, "$check_attr => $desc\n"; + } + } + } + xCAT::MsgUtils->message("I", $rsp, $::callback); + # } + push(@checkedattrs, $attr_name); + next; + } if ( !($objhash{$objname}{$check_attr} =~ /\b$check_value\b/) && !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/) ) {