pf-tools commit: r872 [ccaillet-guest] - in /branches/next-gen: debian/changelog lib/PFTools/Conf/Syntax.pm lib/PFTools/Structqueries.pm lib/PFTools/Update.pm lib/PFTools/Update/Installpkg.pm lib/PFTools/Utils.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Wed Sep 1 08:34:51 UTC 2010


Author: ccaillet-guest
Date: Wed Sep  1 08:34:48 2010
New Revision: 872

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=872
Log:
  - fix regex for mode directive in misc sections
  - adding some keys into substitution hash when updating configuration

Modified:
    branches/next-gen/debian/changelog
    branches/next-gen/lib/PFTools/Conf/Syntax.pm
    branches/next-gen/lib/PFTools/Structqueries.pm
    branches/next-gen/lib/PFTools/Update.pm
    branches/next-gen/lib/PFTools/Update/Installpkg.pm
    branches/next-gen/lib/PFTools/Utils.pm

Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=872&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Wed Sep  1 08:34:48 2010
@@ -23,6 +23,7 @@
     - extracting syntax checks from PFTools::Conf to PFTools::Conf::Syntax
     - using named backreference for using into Init_SUBST function
     which is more flexible for future evolutions
+    - fix regex for mode directive in misc sections
   * lib/PFTools/Conf/Host.pm
     - moving PFTools::Host to PFTools::Conf::Host because functions are
     dedicated to configuration structure building
@@ -32,6 +33,7 @@
   * lib/PFTools/Utils.pm
     - fix on Ini_TOOLS : if storable file doesn't exist we need to parse
     - cosmetic for building zone in __Mk_zoneheader and Mk_zone_for_site
+    - adding some keys into substitution hash when updating configuration
   * lib/PFTools/Update.pm
     - splitting $FUNCTION and $DEPENDS to perl package under PFTools::Update::*
     - privatizing __Trie_prio and fix for action installpkg or purgepkg
@@ -77,7 +79,7 @@
   * tools/Translate_old_config
     - tools for translating old configuration (pf-tools 0.XX) into new syntax
 
- -- Christophe Caillet <tof at sitadelle.com>  Tue, 31 Aug 2010 17:07:53 +0200
+ -- Christophe Caillet <tof at sitadelle.com>  Wed, 01 Sep 2010 10:32:43 +0200
 
 pf-tools (0.99.98-1) unstable; urgency=low
 

Modified: branches/next-gen/lib/PFTools/Conf/Syntax.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Conf/Syntax.pm?rev=872&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Conf/Syntax.pm (original)
+++ branches/next-gen/lib/PFTools/Conf/Syntax.pm Wed Sep  1 08:34:48 2010
@@ -240,7 +240,7 @@
 		'mkdir' => {
 			'owner'			=> '([\d]+|[a-z\d\-]+)',
 			'group'			=> '([\d]+|[a-z\d\-]+)',
-			'mode'			=> '0?[0-7]{3}',
+			'mode'			=> '[0-7]?[0-7]{3}',
 			'on_config'		=> 'undefined',
 			'before_change'	=> 'undefined',
 			'on_noaction'	=> 'undefined',
@@ -260,7 +260,7 @@
 			'source'			=> 'undefined',
 			'fstype'			=> '(nfs|ext[2-4]|btrfs|cifs)',
 			'options'			=> 'undefined',
-			'mode'				=> '0?[0-7]{3}'
+			'mode'				=> '[0-7]?[0-7]{3}'
 		},
 		'installpkg' => {
 			'version'		=> 'undefined',

Modified: branches/next-gen/lib/PFTools/Structqueries.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Structqueries.pm?rev=872&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Structqueries.pm (original)
+++ branches/next-gen/lib/PFTools/Structqueries.pm Wed Sep  1 08:34:48 2010
@@ -40,6 +40,8 @@
 	Get_site_from_hostname
 	Get_site_list
 	Get_cmdline_from_hostprops
+	Get_distrib_from_hostprops
+	Get_mode_from_hostprops
 	Get_pkgtype_from_hostname
 	Get_host_config_from_CONFIG
 	Resolv_hostname_from_GLOBAL
@@ -314,6 +316,18 @@
 		last;
 	}
 	return ( $cmdline, $bond_cmdline );
+}
+
+sub Get_distrib_from_hostprops ($) {
+	my ( $host_props ) = @_;
+
+	return $host_props->{'deployment'}->{'distrib'};
+}
+
+sub Get_mode_from_hostprops ($) {
+	my ( $host_props ) = @_;
+
+	return $host_props->{'deployment'}->{'mode'};
 }
 
 sub Resolv_hostname_from_GLOBAL ($$$$$) {

Modified: branches/next-gen/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update.pm?rev=872&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update.pm (original)
+++ branches/next-gen/lib/PFTools/Update.pm Wed Sep  1 08:34:48 2010
@@ -83,6 +83,8 @@
 sub Exec_action ($$$$$$) {
 	my ( $action, $ref_section, $dest, $options, $hash_subst, $global_config ) = @_;
 
+	# Adding some commons entries into substitution hash : $hash_subst
+	$hash_subst->{'SECTIONNAME'} = $dest;
 	return 0 if ( $action eq "ignore" );
 	return Addfile_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "addfile" );
 	if ( $action eq "apt-get" || $action eq "installpkg" ) {

Modified: branches/next-gen/lib/PFTools/Update/Installpkg.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update/Installpkg.pm?rev=872&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update/Installpkg.pm (original)
+++ branches/next-gen/lib/PFTools/Update/Installpkg.pm Wed Sep  1 08:34:48 2010
@@ -75,7 +75,6 @@
 
 	my $name_filter = $ref_section->{'name_filter'};
 	if ( $name_filter ) {
-		$hash_subst->{'SECTIONNAME'} = $dest;
 		my $newdest = deferredlogpipe ( Subst_vars ( $name_filter, $hash_subst ) );
 		unless ( defined $newdest ) {
 			Warn( $CODE->{'OPEN'}, "Unable to apply name_filter".$name_filter );
@@ -87,6 +86,7 @@
 		}
 		$dest = $newdest;
 	}
+	$hash_subst->{'SECTIONNAME'} = $dest;
 	( $installed_version, $available_version, $specified_version ) = Get_pkg_policy ( $options->{'pkg_type'}, $dest, $ref_section->{'version'} ) ;
 	if ( ! defined ( $available_version ) ) {
 		Warn( $CODE->{'OPEN'}, "Package ".$dest." is unavailable" );

Modified: branches/next-gen/lib/PFTools/Utils.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Utils.pm?rev=872&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Utils.pm (original)
+++ branches/next-gen/lib/PFTools/Utils.pm Wed Sep  1 08:34:48 2010
@@ -865,6 +865,13 @@
 	}
 	Unset_deferredlog ();
 	my $hash_subst	= Init_SUBST ( $hostname, $pf_config );
+	my $host_props	= Get_host_config_from_CONFIG ( $hostname, $global_config, $site );
+	if ( ! defined $host_props ) {
+		Abort ( $CODE->{'UNDEF_KEY'},
+			"Unable to retrieve host properties from hostname ".$hostname );
+	}
+	$hash_subst->{'DISTRIB'}	= Get_distrib_from_hostprops ( $host_props );
+	$hash_subst->{'MODE'}		= Get_mode_from_hostprops ( $host_props ); 
 	if ( ! defined $options->{'pkg_type'} ) {
 		unless ( $options->{'pkg_type'}	= Get_pkgtype_from_hostname ( $hostname, $global_config, $site ) ) {
 			Abort ( $CODE->{'INVALID_VALUE'},




More information about the pf-tools-commits mailing list