r37147 - in /trunk/libconfig-model-backend-augeas-perl: Build.PL ChangeLog META.yml debian/changelog debian/control lib/Config/Model/Backend/Augeas.pm t/augeas_backend.t t/augeas_from_scratch.t t/test_model.pl

ddumont-guest at users.alioth.debian.org ddumont-guest at users.alioth.debian.org
Mon Jun 1 09:35:45 UTC 2009


Author: ddumont-guest
Date: Mon Jun  1 09:35:40 2009
New Revision: 37147

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37147
Log:
new upstream release

Modified:
    trunk/libconfig-model-backend-augeas-perl/Build.PL
    trunk/libconfig-model-backend-augeas-perl/ChangeLog
    trunk/libconfig-model-backend-augeas-perl/META.yml
    trunk/libconfig-model-backend-augeas-perl/debian/changelog
    trunk/libconfig-model-backend-augeas-perl/debian/control
    trunk/libconfig-model-backend-augeas-perl/lib/Config/Model/Backend/Augeas.pm
    trunk/libconfig-model-backend-augeas-perl/t/augeas_backend.t
    trunk/libconfig-model-backend-augeas-perl/t/augeas_from_scratch.t
    trunk/libconfig-model-backend-augeas-perl/t/test_model.pl

Modified: trunk/libconfig-model-backend-augeas-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/Build.PL?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/Build.PL (original)
+++ trunk/libconfig-model-backend-augeas-perl/Build.PL Mon Jun  1 09:35:40 2009
@@ -1,6 +1,6 @@
 # $Author: ddumont $
-# $Date: 2008-11-10 16:54:24 +0100 (Mon, 10 Nov 2008) $
-# $Revision: 792 $
+# $Date: 2009-05-28 13:51:31 +0200 (jeu 28 mai 2009) $
+# $Revision: 963 $
 
 #    Copyright (c) 2008 Dominique Dumont.
 #
@@ -41,7 +41,7 @@
 		      'Log::Log4perl'     => '1.11', # for TRACE log level
 		      'Exception::Class'  => 0,
 		      'Config::Augeas' => '0.303',
-		      'Config::Model'  => '0.631',
+		      'Config::Model'  => '0.636',
 		     },
    build_requires => {
 		      'Test::More'        => 0,

Modified: trunk/libconfig-model-backend-augeas-perl/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/ChangeLog?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/ChangeLog (original)
+++ trunk/libconfig-model-backend-augeas-perl/ChangeLog Mon Jun  1 09:35:40 2009
@@ -1,3 +1,14 @@
+2009-05-29  Dominique Dumont  <dominique.dumont at hp.com> v0.107 (unreleased)
+
+	* lib/Config/Model/Backend/Augeas.pm (all): Use Log::Log4perl for
+	trace with Data::Read and Data::Write categories
+
+2009-05-28  Dominique Dumont  <dominique.dumont at hp.com> 
+
+	* lib/Config/Model/Backend/Augeas.pm: replaced obsolete
+	config_file parameter with file (Config::Model 0.636)
+	(all): ignore Augeas #comment nodes
+
 2009-03-31  Dominique Dumont  <dominique.dumont at hp.com> v0.106
 
 	* t/*.t: fixed tests that broke with Config::Model 0.634

Modified: trunk/libconfig-model-backend-augeas-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/META.yml?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/META.yml (original)
+++ trunk/libconfig-model-backend-augeas-perl/META.yml Mon Jun  1 09:35:40 2009
@@ -1,6 +1,6 @@
 ---
 name: Config-Model-Backend-Augeas
-version: 0.106
+version: 0.107
 author:
   - Dominique Dumont (ddumont at cpan dot org)
 abstract: Read and write configuration data through Augeas
@@ -9,7 +9,7 @@
   license: http://opensource.org/licenses/lgpl-license.php
 requires:
   Config::Augeas: 0.303
-  Config::Model: 0.631
+  Config::Model: 0.636
   Exception::Class: 0
   Log::Log4perl: 1.11
 build_requires:
@@ -19,8 +19,8 @@
 provides:
   Config::Model::Backend::Augeas:
     file: lib/Config/Model/Backend/Augeas.pm
-    version: 0.106
-generated_by: Module::Build version 0.3
+    version: 0.107
+generated_by: Module::Build version 0.33
 meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.2.html
-  version: 1.2
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4

Modified: trunk/libconfig-model-backend-augeas-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/debian/changelog?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/debian/changelog (original)
+++ trunk/libconfig-model-backend-augeas-perl/debian/changelog Mon Jun  1 09:35:40 2009
@@ -1,3 +1,11 @@
+libconfig-model-backend-augeas-perl (0.107-1) UNRELEASED; urgency=low
+
+  * New upstream release (skip Augeas #comment nodes)
+  * control: Depends on libconfig-model-perl >= 0.636
+  * Fix FTBS of libconfig-model-openssh (Closes: #531233)
+	
+ -- Dominique Dumont <dominique.dumont at hp.com>  Mon, 01 Jun 2009 11:24:39 +0200
+
 libconfig-model-backend-augeas-perl (0.106-1) unstable; urgency=low
 
   * New upstream release (only test changes to fix FTBS)

Modified: trunk/libconfig-model-backend-augeas-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/debian/control?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/debian/control (original)
+++ trunk/libconfig-model-backend-augeas-perl/debian/control Mon Jun  1 09:35:40 2009
@@ -6,7 +6,7 @@
 Build-Depends-Indep: perl (>= 5.8.8-12), 
 		     libaugeas-dev (>= 0.3.5),
 		     libconfig-augeas-perl (>= 0.303),
-		     libconfig-model-perl,
+		     libconfig-model-perl (>= 0.636),
 		     libexception-class-perl,
 		     liblog-log4perl-perl (>= 1.11),
 		     libtest-exception-perl, 
@@ -24,7 +24,7 @@
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}, 
 	 libconfig-augeas-perl (>= 0.303),
-	 libconfig-model-perl,
+	 libconfig-model-perl (>= 0.636),
 	 libexception-class-perl,
 	 liblog-log4perl-perl (>= 1.11)
 Description: Read and write configuration data through Augeas

Modified: trunk/libconfig-model-backend-augeas-perl/lib/Config/Model/Backend/Augeas.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/lib/Config/Model/Backend/Augeas.pm?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/lib/Config/Model/Backend/Augeas.pm (original)
+++ trunk/libconfig-model-backend-augeas-perl/lib/Config/Model/Backend/Augeas.pm Mon Jun  1 09:35:40 2009
@@ -1,6 +1,6 @@
 # $Author: ddumont $
-# $Date: 2009-03-31 18:20:13 +0200 (Tue, 31 Mar 2009) $
-# $Revision: 911 $
+# $Date: 2009-05-29 14:40:50 +0200 (ven 29 mai 2009) $
+# $Revision: 965 $
 
 #    Copyright (c) 2008-2009 Dominique Dumont.
 #
@@ -27,12 +27,13 @@
 use Config::Model::Exception ;
 use UNIVERSAL ;
 use File::Path;
+use Log::Log4perl qw(get_logger :levels);
 
 my $has_augeas = 1;
 eval { require Config::Augeas ;} ;
 $has_augeas = 0 if $@ ;
 
-our $VERSION = '0.106';
+our $VERSION = '0.107';
 
 =head1 NAME
 
@@ -47,7 +48,7 @@
 
    # try Augeas and fall-back with custom method
    read_config  => [ { backend => 'augeas' , 
-                       config_file => '/etc/ssh/sshd_config',
+                       file => '/etc/ssh/sshd_config',
                        # declare "seq" Augeas elements 
                        sequential_lens => [/AcceptEnv AllowGroups [etc]/],
                      },
@@ -81,9 +82,9 @@
 Either C<backup> or C<newfile>. See L<Config::Augeas/Constructor> for
 details.
 
-=item config_file
-
-Name of the config_file.
+=item file
+
+Name of the configuration file.
 
 =item sequential_lens
 
@@ -97,7 +98,7 @@
 
    read_config  => [ { backend => 'augeas' , 
                        save   => 'backup',
-                       config_file => '/etc/ssh/sshd_config',
+                       file => '/etc/ssh/sshd_config',
                        # declare "seq" Augeas elements 
                        sequential_lens => [/AcceptEnv AllowGroups/],
                      },
@@ -231,7 +232,12 @@
     $self->{augeas_obj} ||= Config::Augeas->new(root => $args{root}, 
 						save => $args{save} ) ;
 
-    foreach my $param (qw/config_dir config_file/) {
+    if (defined $args{config_file}) { 
+	warn "Augeas::read : deprecated config_file parameter, use file instead\n";
+	$args{file}||= delete $args{config_file} ; 
+    }
+
+    foreach my $param (qw/config_dir file/) {
 	if (not defined $args{$param}) {
 	    Config::Model::Exception::Model -> throw
 		(
@@ -243,11 +249,11 @@
     }
 
     my $cdir = $args{root}.$args{config_dir} ;
-    print "Read config data through Augeas in directory '$cdir' ",
-      "file $args{config_file}\n" 
-	if $::verbose;
-
-    my $mainpath = '/files'.$args{config_dir}.$args{config_file} ;
+    my $logger =  get_logger('Data::Read') ;
+    $logger->info( "Read config data through Augeas in directory '$cdir' ".
+		   "file $args{file}");
+
+    my $mainpath = '/files'.$args{config_dir}.$args{file} ;
 
     my @result =  $self->augeas_deep_match($mainpath) ;
     my @cm_path = @result ;
@@ -278,7 +284,8 @@
 	my $v = $augeas_obj->get($aug_p) ;
 	next unless defined $v ;
 
-	print "read-augeas $aug_p, will set C::M path $cm_p with $v\n" if $::debug ;
+	$logger->debug("read-augeas $aug_p, will set C::M path $cm_p with $v");
+
 	$cm_p =~ s!^/!! ;
 	# With some list, we can get
 	# /files/etc/ssh/sshd_config/AcceptEnv[1]/1/ =  LC_PAPER
@@ -302,9 +309,9 @@
 	while (my $step = shift @cm_steps) {
 	    my ($label,$idx) = ( $step =~ /(\w+)(?:\[(\d+)\])?/ ) ;
 	    my $is_seq = $is_seq_lens{$label} || 0 ;
-	    print "read-augeas: step label $label ",
-	      defined $idx ? "idx $idx ": '', "(is_seq $is_seq)\n"
-		if $::debug ; 
+	    $logger
+	      ->debug("read-augeas: step label $label ".
+		      (defined $idx ? "idx $idx ": '') . "(is_seq $is_seq)");
 
 	    # idx will be treated next iteration if needed
 	    if (    $obj->get_type eq 'node' 
@@ -312,7 +319,8 @@
 		and $is_seq
 	       ) {
 		$idx = 1 unless defined $idx ;
-		print "read-augeas: keep seq lens idx $idx\n" if $::debug ; 
+		$logger
+		  ->debug("read-augeas: keep seq lens idx $idx") ; 
 		unshift @cm_steps , $idx ;
 	    }
 
@@ -329,12 +337,12 @@
 	    # augeas list begin at 1 not 0
 	    $label -= 1 if $obj->get_type eq 'list';
 	    if (scalar @cm_steps > 0) {
-		print "read-augeas: get $label\n" if $::debug;
+		$logger ->debug("read-augeas: get $label");
 		$obj = $obj->get($label) ;
 	    }
 	    else {
 		# last step
-		print "read-augeas: set $label $v\n" if $::debug ; 
+		$logger->debug("read-augeas: set $label $v"); 
 		$obj->set($label,$v) ;
 	    }
 
@@ -359,27 +367,42 @@
     # level 
     # See https://www.redhat.com/archives/augeas-devel/2008-July/msg00016.html
     my @worklist = ( $mainpath );
-    print "read-augeas on @worklist\n" if $::debug ;
+    my $logger = get_logger('Data::Read') ;
+    $logger ->debug("read-augeas on @worklist") ;
 
     my $augeas_obj = $self->{augeas_obj} ;
     my @result ;
     while (@worklist) {
 	my $p = pop @worklist ;
-	my @newpath = $augeas_obj -> match($p . "/*") ;
-	print "read-augeas $p/* matches paths: @newpath\n" if $::debug ;
+	# filter out comments 
+	# see http://augeas.net/page/Path_expressions
+	my @newpath = $augeas_obj -> match($p . "/*[label() != '#comment']") ;
+	$logger
+	  ->debug("read-augeas $p/* matches paths: @newpath") ;
 	push @worklist, @newpath ;
 	push @result,   @newpath ;
     }
 
     return @result ;
 }
+
+# this is a bit of a hack. This function is called by Autoread to
+# check whether the configuration file should be opened before calling
+# write or not. If the config file is opened before augeas writes in
+# it, all comments and structure is lost.
+sub skip_open { 1;}
 
 sub write {
     my $self = shift;
     my %args = @_ ; # contains root and config_dir
     return 0 unless $has_augeas ;
 
-    foreach my $param (qw/config_dir config_file/) {
+    if (defined $args{config_file}) { 
+	warn "Augeas::write : deprecated config_file parameter, use file instead\n";
+	$args{file}||= delete $args{config_file} ; 
+    }
+
+    foreach my $param (qw/config_dir file/) {
 	if (not defined $args{$param}) {
 	    Config::Model::Exception::Model -> throw
 		(
@@ -391,12 +414,12 @@
     }
 
     my $cdir = $args{root}.$args{config_dir} ;
-    print "Write config data through Augeas in directory '$cdir' ",
-      "file $args{config_file}\n" 
-	if $::verbose;
+    get_logger("Data::Write")
+      ->info("Write config data through Augeas in directory '$cdir' ".
+	     "file $args{file}");
 
     my $set_in = $args{set_in} || '';
-    my $mainpath = '/files'.$args{config_dir}.$args{config_file} ;
+    my $mainpath = '/files'.$args{config_dir}.$args{file} ;
     my $augeas_obj =   $self->{augeas_obj} 
                    ||= Config::Augeas->new(root => $args{root}, 
 					   save => $args{save} ) ;
@@ -411,7 +434,8 @@
     my $self = shift ;
     my $mainpath = shift ;
 
-    $self->{augeas_obj}->print() if $::debug ;
+    # can't use augeas print directly in logging system...
+    $self->{augeas_obj}->print() if get_logger('Data::Write')->is_debug ;
 
     $self->{augeas_obj}->save || die "Augeas save failed" . 
       $self->{augeas_obj}->print("/augeas/$mainpath/*");
@@ -454,7 +478,7 @@
 
     my $v = $value_obj->fetch () ; 
     if (defined $v and $v ne '') {
-	print "copy_in_augeas: set $p = '$v'\n" if $::verbose;
+	get_logger("Data::Write")->info("copy_in_augeas: set $p = '$v'");
 	$augeas_obj->set($p , $v) ;
 	#$self->save($mainpath) if $::debug ;
     }
@@ -473,10 +497,12 @@
     # corresponding hash-like keys in Augeas tree
 
     # find Augeas nodes matching this path
-    my @matches = $augeas_obj->match($p) ;
+    my @matches = $augeas_obj->match($p."[label() != '#comment']") ;
 
     # need to find 2nd levels of sub-nodes for non-seq list lenses
-    @matches = sort map { $augeas_obj->match($_.'/*') ; } @matches 
+    @matches = sort map { 
+	$augeas_obj->match($_."/*[label() != '#comment']") ; 
+    } @matches 
       unless $is_seq ;
 
     # Depending on the syntax, list can be in the form:
@@ -493,8 +519,9 @@
 	map { s/$element_name(?!\[)/$replace/ } @matches ;
     }
 
-    print "copy_in_augeas: List (@idx) path $p matches (seq $is_seq):\n\t",
-      join("\n\t", at matches),"\n" if $::debug;
+    my $logger = get_logger("Data::Write") ;
+    $logger->debug("copy_in_augeas: List (@idx) path $p matches (seq $is_seq):\n\t".
+	      join("\n\t", at matches));
 
     # store list indexes found in Augeas and their corresponding path
     my %match = map { 
@@ -508,7 +535,7 @@
     # tree. Create a new Augeas path for sequential list lenses. This
     # path will be used by scan_list
     if ($is_seq) {
-	my $count = $augeas_obj->count_match($p) ;
+	my $count = $augeas_obj->count_match($p."[label() != '#comment']") ;
 	foreach my $idx (@idx) {
 	    # augeas index starts at 1 not 0
 	    my $i = $idx + 1; 
@@ -516,8 +543,8 @@
 
 	    $match{$i} = $p.'['.++$count."]" . ($is_seq ? '' : "/$i");
 
-	    print "copy_in_augeas: New list path $match{$i} for index $i\n"
-	      if $::debug;
+	    $logger->debug("copy_in_augeas: New list path $match{$i} "
+			   ."for index $i");
 	} 
     }
 
@@ -527,8 +554,7 @@
 	# use Augeas path (given by match command) or the path
 	# created for unknown non-seq list elements
 	my $scan_path = delete $match{$i+1} || $p.'/'.($i+1);
-	print "copy_in_augeas: scan list called on $scan_path index $i\n"
-	      if $::debug;
+	$logger->debug("copy_in_augeas: scan list called on $scan_path index $i");
 	$scanner->scan_list([$scan_path,$augeas_obj,$set_in,$is_seq_lens], 
 			    $node,$element_name,$i);
     }
@@ -537,17 +563,16 @@
     foreach (keys %match) {
 	my $rm_path = $match{$_} ;
 
-	print "copy_in_augeas: List rm $_ ->$rm_path\n" if $::debug; 
+	$logger->debug("copy_in_augeas: List rm $_ ->$rm_path"); 
 	$augeas_obj->remove($rm_path) || die "remove $rm_path failed";
 
 	# check if removing parent node in Augeas is needed
 	$rm_path =~ s!/([\w\[\]\-]+)$!! ; # chomp last "step" of the path
-	if ($augeas_obj->count_match($rm_path) == 1
+	if ($augeas_obj->count_match($rm_path."[label() != '#comment']") == 1
 	    and $set_in ne $element_name 
 	    and $rm_path =~ /$element_name$/
 	   ) {
-	    print "copy_in_augeas: List rm parent node $_ ->$rm_path\n" 
-	      if $::debug; 
+	    $logger->debug("copy_in_augeas: List rm parent node $_ ->$rm_path");
 	    $augeas_obj->remove($rm_path) || die "remove $rm_path failed";
 	}
     }
@@ -563,10 +588,12 @@
     # corresponding hash-like keys in Augeas tree
 
     # find Augeas nodes matching this path
-    my @matches = $augeas_obj->match($p) ;
+    my @matches = $augeas_obj->match($p."[label() != '#comment']") ;
 
     # need to find 2nd levels of sub-nodes 
-    @matches = sort map { $augeas_obj->match($_.'/*') ; } @matches ;
+    @matches = sort map { 
+	$augeas_obj->match($_."/*[label() != '#comment']") ; 
+    } @matches ;
 
     # sequential lens need a list index to store element.  I.e
     # foo[1]/key1 foo[2]/key2 is ok. foo/key1 foo/key2 will fail But
@@ -577,8 +604,9 @@
 	map { s/$element_name(?!\[)/$replace/ } @matches ;
     }
 
-    print "copy_in_augeas: Hash path $p matches (seq $is_seq):\n\t", 
-      join("\n\t", at matches),"\n" if $::debug;
+    my $logger = get_logger('Data::Write') ;
+    $logger->debug("copy_in_augeas: Hash path $p matches (seq $is_seq):\n\t". 
+		   join("\n\t", at matches));
 
     # store indexes found in Augeas and their corresponding path
     my %match = map { 
@@ -593,18 +621,17 @@
     # path will be used by scan_list. This insertion cannot be done if
     # no elements are already present in Augeas tree.
     if ($is_seq and @matches) {
-	my $count = $augeas_obj->count_match($p) ;
+	my $count = $augeas_obj->count_match($p."[label() != '#comment']") ;
 	foreach (@keys) {
 	    next if defined $match{$_} ;
 
 	    my $ip = $p.'[last()]';
-	    print "inserting $element_name after $ip\n" if $::debug ;
+	    $logger->debug("inserting $element_name after $ip\n");
 	    $augeas_obj->insert($element_name, after => $ip ) 
 	      || die "augeas insert $element_name after $ip failed";
 
 	    my $np = $match{$_} = $p.'['.++$count."]/$_";
-	    print "copy_in_augeas: New hash path $np for key $_\n"
-	      if $::debug;
+	    $logger->debug("copy_in_augeas: New hash path $np for key $_");
 	} 
     }
 
@@ -621,16 +648,15 @@
     # cleanup keys found in Augeas but not in Config::Model
     foreach (keys %match) {
 	my $rm_path = $match{$_} ;
-	print "copy_in_augeas: Hash rm $_ ->$rm_path\n" if $::debug; 
+	$logger->debug("copy_in_augeas: Hash rm $_ ->$rm_path"); 
 	$augeas_obj->remove($rm_path) || die "remove $rm_path failed";
 
 	# check if removing parent node in Augeas is needed
 	$rm_path =~ s!/([\w\[\]\-]+)$!! ;
-	if (    $augeas_obj->count_match($rm_path) == 1 
+	if (    $augeas_obj->count_match($rm_path."[label() != '#comment']") == 1 
 	    and $set_in ne $element_name and $is_seq
 	   ) {
-	    print "copy_in_augeas: Hash rm parent $_ ->$rm_path\n" 
-	      if $::debug; 
+	    $logger->debug("copy_in_augeas: Hash rm parent $_ ->$rm_path");
 	    $augeas_obj->remove($rm_path) || die "remove $rm_path failed";
 	}
     }
@@ -640,20 +666,22 @@
     my ($scanner, $data_ref,$node, at element) = @_ ;
     my ($p,$augeas_obj,$set_in,$is_seq_lens) = @$data_ref ;
 
+    my $logger = get_logger('Data::Write') ;
+
     # See set_in parameter (who said kludge ?)
     if (scalar @element == 1 and $element[0] eq $set_in) {
 	# Augeas tree is stored below element[0]
-	print "copy_in_augeas: Augeas tree set in node path $p\n" if $::debug;
+	$logger->debug("copy_in_augeas: Augeas tree set in node path $p");
 	$scanner->scan_element([$p,$augeas_obj,$set_in,$is_seq_lens], 
 			       $node,$element[0]);
     }
     else {
-	my @matches = $augeas_obj->match($p.'/*') ;
+	my @matches = $augeas_obj->match($p."/*[label() != '#comment']") ;
 	# cleanup indexes are we don't handle them now with element
 	# (later in lists and hashes)
 	map { s/\[\d+\]+$//;  } @matches ;
-	print "copy_in_augeas: Node path $p matches:\n\t", 
-	  join("\n\t", at matches),"\n" if $::debug;
+	$logger->debug("copy_in_augeas: Node path $p matches:\n\t". 
+		       join("\n\t", at matches),);
 
 	# store elements found in Augeas and their corresponding path
 	my %match = map { 
@@ -679,13 +707,12 @@
                           ? (after  => $p.'/'.$previous_match.'[last()]')
 		          : (before => $matches[0]     ) ;
 
-		    print "inserting $_ $direction $ip\n" if $::debug ;
+		    $logger->debug("inserting $_ $direction $ip");
 		    $augeas_obj->insert($_, $direction => $ip ) 
 		      || die "augeas insert $_ $direction $ip failed";
 
 		    my $np = $match{$_} = "$p/$_";
-		    print "copy_in_augeas: New hash path $np for element $_\n"
-		      if $::debug;
+		    $logger->debug("copy_in_augeas: New hash path $np for element $_");
 		}
 	    } 
 	}
@@ -696,8 +723,7 @@
 	    # use Augeas path (given by match command) or the path
 	    # created for new elements
 	    my $scan_path = delete $match{$_} || $p.'/'.$_ ;
-	    print "copy_in_augeas: Node scan $scan_path for element $_\n" 
-	      if $::debug;
+	    $logger->debug("copy_in_augeas: Node scan $scan_path for element $_");
 	    $scanner->scan_element([$scan_path,$augeas_obj,$set_in,$is_seq_lens],
 				   $node,$_)
 	}
@@ -705,7 +731,7 @@
 	# cleanup keys found in Augeas but not in Config::Model
 	foreach (keys %match) {
 	    my $rm_path = $match{$_} ;
-	    print "copy_in_augeas: Node rm $_ ->$rm_path\n" if $::debug; 
+	    $logger->debug("copy_in_augeas: Node rm $_ ->$rm_path");
 	    $augeas_obj->remove($rm_path) || die "remove $rm_path failed";
 	}
     }
@@ -714,6 +740,21 @@
 
 1;
 
+=head1 Log and trace
+
+This module use L<Log::Log4perl> to log debug and info trace with
+C<Data::Read> and C<Data::Write> categories.
+
+=head1 CAVEATS
+
+=over
+
+=item *
+
+Augeas C<#comment> nodes are ignored
+
+=back
+
 =head1 SEE ALSO
 
 =over 

Modified: trunk/libconfig-model-backend-augeas-perl/t/augeas_backend.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/t/augeas_backend.t?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/t/augeas_backend.t (original)
+++ trunk/libconfig-model-backend-augeas-perl/t/augeas_backend.t Mon Jun  1 09:35:40 2009
@@ -1,12 +1,12 @@
 # -*- cperl -*-
 # $Author: ddumont $
 # $Date: 2008-07-04 16:14:06 +0200 (Fri, 04 Jul 2008) $
-# $Revision: 911 $
+# $Revision: 971 $
 
 # test augeas backend 
 
 # workaround Augeas locale bug
-if ($ENV{LC_ALL} ne 'C' or $ENV{LANG} ne 'C') {
+if (not defined $ENV{LC_ALL} or $ENV{LC_ALL} ne 'C' or $ENV{LANG} ne 'C') {
   $ENV{LC_ALL} = $ENV{LANG} = 'C';
   exec("perl $0 @ARGV");
 }

Modified: trunk/libconfig-model-backend-augeas-perl/t/augeas_from_scratch.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/t/augeas_from_scratch.t?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/t/augeas_from_scratch.t (original)
+++ trunk/libconfig-model-backend-augeas-perl/t/augeas_from_scratch.t Mon Jun  1 09:35:40 2009
@@ -20,7 +20,7 @@
 use vars qw/$model/;
 
 # workaround Augeas locale bug
-if ($ENV{LC_ALL} ne 'C' or $ENV{LANG} ne 'C') {
+if (not defined $ENV{LC_ALL} or $ENV{LC_ALL} ne 'C' or $ENV{LANG} ne 'C') {
   $ENV{LC_ALL} = $ENV{LANG} = 'C';
   exec("perl $0 @ARGV");
 }

Modified: trunk/libconfig-model-backend-augeas-perl/t/test_model.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-model-backend-augeas-perl/t/test_model.pl?rev=37147&op=diff
==============================================================================
--- trunk/libconfig-model-backend-augeas-perl/t/test_model.pl (original)
+++ trunk/libconfig-model-backend-augeas-perl/t/test_model.pl Mon Jun  1 09:35:40 2009
@@ -18,8 +18,8 @@
    name => 'Hosts',
 
    read_config  => [ { backend => 'augeas', 
-		       config_dir => '/etc',
-		       config_file => 'hosts',
+		       config_dir => '/etc/',
+		       file => 'hosts',
 		       set_in => 'record',
 		       save   => 'backup',
 		       #sequential_lens => ['record'],
@@ -41,8 +41,8 @@
 
    'read_config'
    => [ { backend => 'augeas', 
-	  config_dir => '/etc/ssh',
-	  config_file => 'sshd_config',
+	  config_dir => '/etc/ssh/',
+	  file => 'sshd_config',
 	  save   => 'backup',
 	  sequential_lens => [qw/HostKey Subsystem Match/],
 	},




More information about the Pkg-perl-cvs-commits mailing list