From afde43bf133771bdf905e5781ec1c46224e81912 Mon Sep 17 00:00:00 2001 From: nott Date: Mon, 15 Dec 2008 16:53:35 +0000 Subject: [PATCH] Make sure rmdef removes entries from each table even if the key is the only thing set. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2548 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DBobjUtils.pm | 60 ++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 68b6a6279..6b401f575 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -1140,43 +1140,37 @@ sub rmobjdefs { my $attr = $this_attr->{attr_name}; - #only need to bother with tables that have attrs set for this object - if ($DBattrvals{$objname}{$attr}) + # get table lookup info from Schema.pm + + # might need to check the value of other attrs to figure out + # what tables some attrs are in + if (exists($this_attr->{only_if})) { + my ($check_attr, $check_value) = + split('\=', $this_attr->{only_if}); - # get table lookup info from Schema.pm - - # might need to check the value of other attrs to figure out - # what tables some attrs are in - if (exists($this_attr->{only_if})) - { - my ($check_attr, $check_value) = - split('\=', $this_attr->{only_if}); - - # if the object attr value to check is not the value we need - # to match then try the next "only_if" value - # next if $DBattrvals{$objname}{$check_attr} ne $check_value; - next if ( !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/) ); - - } - - # get the info needed to access the DB table - # ex. 'nodelist.node', 'attr:node' - my ($lookup_key, $lookup_value) = - split('\=', $this_attr->{access_tabentry}); - - # ex. 'nodelist', 'node' - my ($lookup_table, $lookup_attr) = split('\.', $lookup_key); - - # ex. 'attr', 'node' - my ($lookup_type, $lookup_data) = split('\:', $lookup_value); - - # we'll need table name, key name, & object name - # put this info in a hash - we'll process it later - below - - push @{$tablehash{$lookup_table}{$lookup_attr}}, $objname; + # if the object attr value to check is not the value we need + # to match then try the next "only_if" value + # next if $DBattrvals{$objname}{$check_attr} ne $check_value; + next if ( !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/) ); } + + # get the info needed to access the DB table + # ex. 'nodelist.node', 'attr:node' + my ($lookup_key, $lookup_value) = + split('\=', $this_attr->{access_tabentry}); + + # ex. 'nodelist', 'node' + my ($lookup_table, $lookup_attr) = split('\.', $lookup_key); + + # ex. 'attr', 'node' + my ($lookup_type, $lookup_data) = split('\:', $lookup_value); + + # we'll need table name, key name, & object name + # put this info in a hash - we'll process it later - below + + push @{$tablehash{$lookup_table}{$lookup_attr}}, $objname; } }