Package: ocsinventory-agent Version: 1:0.0.9.2repack1-4lenny1 Tags: patch I've resolved the problem recoding writeXML() function in Perl file:
/usr/share/perl5/Ocsinventory/Agent/XML/Inventory.pm Patch code: ### --- Inventory.pm 2009-07-13 23:12:43.000000000 +0200 +++ Inventory.pm.zlib 2009-07-13 23:14:51.000000000 +0200 @@ -421,11 +421,14 @@ my $localfile = $self->{params}{local}."/".$self->{params}{deviceid}.'.ocs'; $localfile =~ s!(//){1,}!/!; - # Convert perl data structure into xml strings + # Convert perl data structure into xml strings AND compress file. if (open OUT, ">$localfile") { - print OUT $self->getContent(); - close OUT or warn; + my $inv_content = $self->getContent(); + $inv_content = Compress::Zlib::compress( $inv_content ) or die localtime()." => Compression error. Do you have libcompress-zlib-perl?\n"; + print OUT $inv_content; + binmode OUT; + close OUT or warn; $logger->info("Inventory saved in $localfile"); } else { warn "Can't open `$localfile': $!" ### Note that this function is deprecated in 1.02 ocsinventory-agent version because compress job is directly done in ocsinventory-agent.pl file without getContent() use. In fact, "all" agent code is new. Now, patched, "--local" mode works properly, and ocs resultant file can be imported to the server.
--- Inventory.pm 2009-07-13 23:12:43.000000000 +0200 +++ Inventory.pm.zlib 2009-07-13 23:14:51.000000000 +0200 @@ -421,11 +421,14 @@ my $localfile = $self->{params}{local}."/".$self->{params}{deviceid}.'.ocs'; $localfile =~ s!(//){1,}!/!; - # Convert perl data structure into xml strings + # Convert perl data structure into xml strings AND compress file. if (open OUT, ">$localfile") { - print OUT $self->getContent(); - close OUT or warn; + my $inv_content = $self->getContent(); + $inv_content = Compress::Zlib::compress( $inv_content ) or die localtime()." => Compression error. Do you have libcompress-zlib-perl?\n"; + print OUT $inv_content; + binmode OUT; + close OUT or warn; $logger->info("Inventory saved in $localfile"); } else { warn "Can't open `$localfile': $!"