From 4c689725c66403593da895a736a3a91689b786e7 Mon Sep 17 00:00:00 2001 From: nott Date: Mon, 11 Feb 2008 19:44:59 +0000 Subject: [PATCH] Fix checking of comma separated lists. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@439 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/DBobjUtils.pm | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/DBobjUtils.pm b/perl-xCAT-2.0/xCAT/DBobjUtils.pm index e18f3c391..9e02e09ec 100644 --- a/perl-xCAT-2.0/xCAT/DBobjUtils.pm +++ b/perl-xCAT-2.0/xCAT/DBobjUtils.pm @@ -225,9 +225,7 @@ sub getobjdefs # if the object value is not the value we need # to match then try the next only_if value - next - if ( - !grep(/$check_value/, $objhash{$objname}{$check_attr})); + next if ( !($objhash{$objname}{$check_attr} =~ /\b$check_value\b/) ); } # OK - get the info needed to access the DB table @@ -649,13 +647,8 @@ 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 - if ( - (!grep(/$check_value/, $objhash{$objname}{$check_attr})) - && ( - !grep(/$check_value/, - $DBattrvals{$objname}{$check_attr}) - ) - ) + + if ( !($objhash{$objname}{$check_attr} =~ /\b$check_value\b/) && !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/) ) { next; @@ -898,11 +891,7 @@ sub rmobjdefs # 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 ( - !grep(/$check_value/, - $DBattrvals{$objname}{$check_attr}) - ) + next if ( !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/) ); }