pf-tools commit: r745 [ccaillet-guest] - in /trunk: debian/changelog lib/PFTools/Update.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Jun 1 11:12:56 UTC 2010


Author: ccaillet-guest
Date: Tue Jun  1 11:12:41 2010
New Revision: 745

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=745
Log:
factorizing code for Do_* functions

Modified:
    trunk/debian/changelog
    trunk/lib/PFTools/Update.pm

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=745&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Tue Jun  1 11:12:41 2010
@@ -47,6 +47,7 @@
       before update-hostname01 (thus allowing to ignore in update-hostname01 a
       section defined in update-hostname).
     - avoid multiple calls for updating the repository content (fix regression)
+    - factorizing code for Do_* functions
   * filters/filter_privateresolve : substitution occured with POPNAME keyword
     according to the value extracted from host parameter (backported from branche
     0.33-stable)
@@ -83,7 +84,7 @@
     cmdline defined into host definition
   * debian/control : fixing deps for libmd5-perl which is included in perl >= 5.10
 
- -- Christophe Caillet <quadchris at free.fr>  Fri, 14 May 2010 15:04:20 +0200
+ -- Christophe Caillet <quadchris at free.fr>  Tue, 01 Jun 2010 13:09:43 +0200
 
 pf-tools (0.33.1-1) unstable; urgency=low
 

Modified: trunk/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Update.pm?rev=745&op=diff
==============================================================================
--- trunk/lib/PFTools/Update.pm (original)
+++ trunk/lib/PFTools/Update.pm Tue Jun  1 11:12:41 2010
@@ -320,17 +320,23 @@
     }
 }
 
+sub Exec_cmd ($) {
+	my ( $cmd ) = @_;
+
+	if ( deferredlogsystem($cmd) ) {
+	    Warn( $ERR_OPEN, "Impossible d'executer [" . $cmd . "]" );
+	    return 1;
+	}
+	return 0;
+}
+
 sub Do_on_config {
     my ( $S, $options ) = @_;
 
-    if ( !$options->{'simul'} && defined( $S->{'on_config'} ) ) {
-	my $changed = Subst_vars( $S->{'on_config'} );
-	if ( deferredlogsystem($changed) ) {
-	    Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
-	    return 1;
-	}
-    }
-    return 0;
+    if ( !$options->{'simul'} && defined( $S->{'on_config'} ) )
+	{
+	return Exec_cmd ( Subst_vars ( $S->{'on_config'} ) );
+	}
 }
 
 sub Do_before_change {
@@ -340,13 +346,8 @@
 	&& defined( $S->{'before_change'} )
 	&& !$options->{'noaction'} )
     {
-	my $changed = Subst_vars( $S->{'before_change'} );
-	if ( deferredlogsystem($changed) ) {
-	    Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
-	    return 1;
-	}
-    }
-    return 0;
+	return Exec_cmd ( Subst_vars ( $S->{'before_change'} ) );
+	}
 }
 
 sub Do_after_change {
@@ -356,13 +357,8 @@
 	&& defined( $S->{'after_change'} )
 	&& !$options->{'noaction'} )
     {
-	my $changed = Subst_vars( $S->{'after_change'} );
-	if ( deferredlogsystem($changed) ) {
-	    Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
-	    return 1;
-	}
-    }
-    return 0;
+	return Exec_cmd ( Subst_vars ( $S->{'after_change'} ) );
+    }
 }
 
 sub Do_on_noaction {
@@ -372,13 +368,8 @@
 	&& defined( $S->{'on_noaction'} )
 	&& $options->{'noaction'} )
     {
-	my $changed = Subst_vars( $S->{'on_noaction'} );
-	if ( deferredlogsystem($changed) ) {
-	    Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
-	    return 1;
-	}
-    }
-    return 0;
+	return Exec_cmd ( Subst_vars ( $S->{'on_noaction'} ) );
+    }
 }
 
 my %DEPENDS;




More information about the pf-tools-commits mailing list