diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 27bcf1318..d95fb4736 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -1383,17 +1383,17 @@ sub nodels ######### # tabch ######### + sub tabch { my $args = shift; my $callback = shift; my @ARGV = @{$args}; my $delete = 0; - my $fo = $ARGV[0]; - - if($ARGV[0] =~ /^-d$/){ + if ($ARGV[0] =~ /^-d$/){ shift @ARGV; $delete = 1; } + my $target = shift @ARGV; my %tables; my %keyhash=(); @@ -1409,7 +1409,6 @@ sub tabch { unshift(@ARGV, $target); } - if($delete){ my @tables_to_del=@ARGV; if(@tables_to_del == 0){ @@ -1439,8 +1438,16 @@ sub tabch { $callback->({error => [ "Table $table does not exist."],errorcode=>[1]}); } } + $tableupdates{$table}{$column}=$value; $tableupdates{$table}{$column}=$value; } + #commit all the changes + foreach (keys %tables) { + if (exists($tableupdates{$_})) { + $tables{$_}->setAttribs(\%keyhash,\%{$tableupdates{$_}}); + } + $tables{$_}->commit; + } #commit all the changes foreach (keys %tables) {