pf-tools commit: r836 [ccaillet-guest] - in /branches/next-gen: debian/changelog filters/filter_privateresolve lib/PFTools/Conf.pm lib/PFTools/Translation.pm lib/PFTools/Utils.pm sbin/mk_dhcp sbin/mk_grubopt sbin/mk_sitezone sbin/update-config
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Tue Aug 24 05:18:36 UTC 2010
Author: ccaillet-guest
Date: Tue Aug 24 05:18:32 2010
New Revision: 836
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=836
Log:
- introducing the force-reload parameter for rebuilding the global
configuration from VCS repository even if a storable file exists
* lib/PFTools/Translation.pm
- library for translating old configuration (pf-tools 0.X) to new syntax
Added:
branches/next-gen/lib/PFTools/Translation.pm (with props)
Modified:
branches/next-gen/debian/changelog
branches/next-gen/filters/filter_privateresolve
branches/next-gen/lib/PFTools/Conf.pm
branches/next-gen/lib/PFTools/Utils.pm
branches/next-gen/sbin/mk_dhcp
branches/next-gen/sbin/mk_grubopt
branches/next-gen/sbin/mk_sitezone
branches/next-gen/sbin/update-config
Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=836&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Tue Aug 24 05:18:32 2010
@@ -5,6 +5,8 @@
* sbin/update-config :
- feat: adding check for update in pf-tools.conf, deactivate if not present
or if his value is 0
+ - introducing the force-reload parameter for rebuilding the global
+ configuration from VCS repository even if a storable file exists
* lib/PFTools/Conf.pm
- small fixes on Get_source for order and substitution regex
- rollback for CONFIG: alias with the 0.33-stable substitution value
@@ -33,12 +35,14 @@
- extrating apt-get functions (action and depends) from Update.pm
* lib/PFTools/Update/Removedir.pm
- extrating apt-get functions (action and depends) from Update.pm
+ * lib/PFTools/Translation.pm
+ - library for translating old configuration (pf-tools 0.X) to new syntax
* debian/control
- adding libtext-diff-perl as depends for pf-tools package
* doc/updatefile-syntax
- basic documentation about update file
- -- Christophe Caillet <quadchris at free.fr> Mon, 23 Aug 2010 14:50:49 +0200
+ -- Christophe Caillet <tof at sitadelle.com> Tue, 24 Aug 2010 07:10:10 +0200
pf-tools (0.99.98-1) unstable; urgency=low
Modified: branches/next-gen/filters/filter_privateresolve
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/filters/filter_privateresolve?rev=836&op=diff
==============================================================================
--- branches/next-gen/filters/filter_privateresolve (original)
+++ branches/next-gen/filters/filter_privateresolve Tue Aug 24 05:18:32 2010
@@ -115,8 +115,9 @@
else {
$SITE = $PF_CONFIG->{'location'}->{'site'}
}
- $ZONE = Get_zone_from_site_GLOBAL ( $SITE, $GLOBAL_STRUCT );
}
+
+$ZONE = Get_zone_from_site_GLOBAL ( $SITE, $GLOBAL_STRUCT ) if ( $ZONE eq '' );
if ( $INPUT_FILE eq '' || $OUTPUT_FILE eq '' ) {
Abort ( $CODE->{'UNDEF_KEY'},
Modified: branches/next-gen/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Conf.pm?rev=836&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Conf.pm (original)
+++ branches/next-gen/lib/PFTools/Conf.pm Tue Aug 24 05:18:32 2010
@@ -31,6 +31,7 @@
use PFTools::Parser;
use PFTools::Logger;
use Sys::Hostname;
+use NetAddr::IP;
use Fcntl ':mode';
use Data::Dumper;
use Storable;
@@ -41,7 +42,6 @@
Init_SUBST
Init_PF_CONFIG
Init_GLOBAL_NETCONFIG
- __Translate_old2new_host
Load_conf
Flush2disk_GLOBAL
Retrieve_GLOBAL
@@ -606,164 +606,6 @@
return $global_parsed;
}
-sub __Translate_old2new_host ($$) {
- my ( $host_parsed, $hostname ) = @_;
- my $new_host = {};
-
- if ( $host_parsed->{'type'} !~ /-server$/ ) {
- Warn ( $CODE->{'INVALID_KEY'}, "Unable to translate into new format a section which is not a host declaration" );
- return;
- }
-
- $new_host->{'hostgroup'}->{'hostname'} = $hostname;
- $new_host->{'hostgroup'}->{'comment'} = $host_parsed->{'comment'} || "";
- foreach my $key ( keys %{$host_parsed} ) {
- if ( $key eq 'shortname' ) {
- $new_host->{'dns'}->{'shortname'} = $host_parsed->{'shortname'};
- }
- elsif ( $key eq 'ether' ) {
- foreach my $num ( sort keys %{$host_parsed->{'ether'}} ) {
- $new_host->{'interface::eth0'}->{'mac.'.$num} = $host_parsed->{$key}->{$num};
- }
- }
- elsif ( $key =~ /^arch|distrib|deploymode$/ ) {
- my $new_key = ( $key eq 'deploymode' ) ? 'mode' : $key;
- if ( ref $host_parsed->{$key} eq 'HASH' ) {
- foreach my $subkey ( keys %{$host_parsed->{$key}} ) {
- if ( $subkey eq 'default' ) {
- $new_host->{'deployment'}->{$new_key} = $host_parsed->{$key}->{$subkey};
- }
- else {
- $new_host->{'deployment'}->{$new_key.'.'.$subkey} = $host_parsed->{$key}->{$subkey};
- }
- }
- }
- else {
- $new_host->{'deployment'}->{$new_key} = $host_parsed->{$key};
- }
- }
- elsif ( $key =~ /^order|number$/ ) {
- $new_host->{'hostgroup'}->{$key} = $host_parsed->{$key};
- }
- elsif ( $key eq 'interface' ) {
- foreach my $iface ( keys %{$host_parsed->{$key}} ){
- my $vlan = $host_parsed->{$key}->{$iface};
- $new_host->{'interface::'.$iface}->{'vlan'} = $vlan;
- if ( defined $host_parsed->{'ipstart'}->{$vlan} ) {
- $new_host->{'interface::'.$iface}->{'ipv4'} = $host_parsed->{'ipstart'}->{$vlan};
- }
- elsif ( defined $host_parsed->{'ip'}->{$vlan} ) {
- foreach my $subkey ( keys %{$host_parsed->{'ip'}->{$vlan}} ) {
- if ( $subkey eq 'default' && ! defined $new_host->{'interface::'.$iface}->{'ipv4'} ) {
- $new_host->{'interface::'.$iface}->{'ipv4'} = $host_parsed->{'ip'}->{$vlan}->{$subkey};
- }
- else {
- $new_host->{'interface::'.$iface}->{'ipv4.'.$subkey} = $host_parsed->{'ip'}->{$vlan}->{$subkey};
- }
- }
- }
- else {
- $new_host->{'interface::'.$iface}->{'ipv4'} = $host_parsed->{'ipstart'}->{'default'};
- }
- if ( defined $host_parsed->{$iface} ) {
- foreach my $route ( keys %{$host_parsed->{$iface}} ) {
- if ( ref $host_parsed->{$iface}->{$route} eq 'HASH' ) {
- foreach my $subkey ( keys %{$host_parsed->{$iface}->{$route}} ) {
- if ( $subkey eq 'default' ) {
- push ( @{$new_host->{'interface::'.$iface}->{'@route'}}, $host_parsed->{$iface}->{$route}->{$subkey} );
- }
- else {
- push ( @{$new_host->{'interface::'.$iface}->{'@route.'.$subkey}}, $host_parsed->{$iface}->{$route}->{$subkey} );
- }
- }
- }
- }
- if ( $iface =~ /^bond/ ) {
- if ( ref $host_parsed->{'bonding'}->{$iface} eq 'HASH' ) {
- foreach my $subkey ( keys %{$host_parsed->{'bonding'}->{$iface}} ) {
- if ( $subkey eq 'default' ) {
- $new_host->{'interface::'.$iface}->{'slaves'} = $host_parsed->{'bonding'}->{$iface}->{$subkey};
- }
- else {
- $new_host->{'interface::'.$iface}->{'slaves.'.$subkey} = $host_parsed->{'bonding'}->{$iface}->{$subkey};
- }
- }
- }
- else {
- $new_host->{'interface::'.$iface}->{'slaves'} = $host_parsed->{'bonding'}->{$iface};
- }
- my $ref_cmdline = {};
- if ( ref $host_parsed->{'cmdline'} eq 'HASH' ) {
- $ref_cmdline = $host_parsed->{'cmdline'};
- } else {
- $ref_cmdline->{'default'} = $host_parsed->{'cmdline'};
- }
- foreach my $cmdline ( keys %{$ref_cmdline} ) {
- my $newcmd_key = ( $cmdline eq 'default' ) ? 'cmdline' : 'cmdline.'.$cmdline;
- my $newopt_key = ( $cmdline eq 'default' ) ? 'options' : 'options.'.$cmdline;
- my $newmode_key = ( $cmdline eq 'default' ) ? 'mode' : 'mode.'.$cmdline;
- foreach my $cmd ( split ( / /, $ref_cmdline->{$cmdline} ) ) {
- if ( $cmd =~ /^bonding\.(.+)$/ ) {
- my ( $opt, $val ) = split ( /=/, $1 );
- my $new_opt;
- if ( $opt eq 'mode' ) {
- $new_host->{'interface::'.$iface}->{$newmode_key} = $val;
- }
- else {
- $new_host->{'interface::'.$iface}->{$newopt_key} = $opt.'='.$val.' ';
- }
- }
- else {
- $new_host->{'boot'}->{$newcmd_key} .= $cmd." ";
- }
- }
- $new_host->{'interface::'.$iface}->{$newopt_key} =~ s/\s*$//;
- $new_host->{'boot'}->{$newcmd_key} =~ s/\s*$// if ( $new_host->{'boot'}->{$newcmd_key} );
- }
- }
- }
- }
- }
- elsif ( $key eq 'alias' ) {
- foreach my $alias ( keys %{$host_parsed->{$key}} ) {
- $new_host->{'dns'}->{'alias.'.$alias} = $host_parsed->{$key}->{$alias};
- }
- }
- elsif ( $key eq 'dns' ) {
- if ( ref $host_parsed->{$key} eq 'HASH' ) {
- foreach my $subkey ( keys %{$host_parsed->{$key}} ) {
- my $new_key = ( $subkey eq 'default' ) ? 'resolver' : 'resolver.'.$subkey;
- $new_host->{'dns'}->{$new_key} = $host_parsed->{$key}->{$subkey};
- }
- }
- else {
- $new_host->{'dns'}->{'resolver'} = $host_parsed->{$key};
- }
- }
- elsif ( $key =~ /^console|(pxe|uml)?filename$/ ) {
- my $new_key;
- if ( defined $1 ) {
- $new_key = ( $1 eq 'uml' ) ? 'kerneluml' : 'kernel';
- }
- elsif ( $key eq 'filename' ) {
- $new_key = 'pxefilename';
- }
- else {
- $new_key = $key;
- }
- if ( ref $host_parsed->{$key} eq 'HASH' ) {
- foreach my $subkey ( keys %{$host_parsed->{$key}} ) {
- my $newsub_key = ( $subkey eq 'default' ) ? $new_key : $new_key.'.'.$subkey;
- $new_host->{'boot'}->{$newsub_key} = $host_parsed->{$key}->{$subkey};
- }
- }
- else {
- $new_host->{'boot'}->{$new_key} = $host_parsed->{$key};
- }
- }
- }
- return $new_host;
-}
sub Load_conf ($$$$) {
my ( $file, $hash_subst, $context, $pf_config ) = @_;
Added: branches/next-gen/lib/PFTools/Translation.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Translation.pm?rev=836&op=file
==============================================================================
--- branches/next-gen/lib/PFTools/Translation.pm (added)
+++ branches/next-gen/lib/PFTools/Translation.pm Tue Aug 24 05:18:32 2010
@@ -1,0 +1,260 @@
+package PFTools::Translation;
+##
+## $Id$
+##
+## Copyright (C) 2010 Christophe Caillet <quadchris at free.fr>
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+##
+
+use strict;
+use warnings;
+
+use Exporter;
+
+our @ISA = ('Exporter');
+
+our @EXPORT = qw (
+ Translate_old2new_host
+ Translate_old2new_network
+);
+
+our @EXPORT_OK = qw();
+
+use PFTools::Logger;
+use PFTools::Parser;
+use NetAddr::IP;
+
+sub Translate_old2new_config ($$) {
+ my ( $conf_parsed, $section_name ) = @_;
+
+ my $new_section = $conf_parsed;
+ foreach my $section ( keys %{$new_section} ) {
+ foreach my $key ( keys %{$new_section->{$section}} ) {
+ # Filter substitution
+ $new_section->{$section}->{$key} =~ s/(filter_(\S+)) (\S+) (\S+) (\S+)/$1 -i $3 -h $4 -o $4/g;
+ if ( $new_section->{$section}->{$key} =~ /mk_pxelinuxcfg/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_pxelinuxcfg (\S+) (\S+)/mk_pxelinuxcfg $1/;
+ }
+ elsif ( $new_section->{$section}->{$key} =~ /mk_grubopt/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_grubopt -d (\S+) --host (\S+)/mk_grubopt -h $2 -o $1 --grub 1/;
+ }
+ elsif ( $new_section->{$section}->{$key} =~ /mk_grub2opt/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_grubopt -d (\S+) --host (\S+)/mk_grubopt -h $2 -o $1/;
+ }
+ elsif ( $new_section->{$section}->{$key} =~ /mk_resolvconf/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_resolvconf (\S+) (\S+) (\S+)/mk_resolvconf -h $2 -o $3/;
+ }
+ elsif ( $new_section->{$section}->{$key} =~ /mk_interfaces/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_interfaces (\S+) (\S+) (\S+)/mk_interfaces -h $2 -o $3/;
+ }
+ elsif ( $new_section->{$section}->{$key} =~ /mk_dhcp/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_dhcp (\S+) (\S+) (\S+)/mk_dhcp -H $1 -o $3/;
+ }
+ elsif ( $new_section->{$section}->{$key} =~ /mk_privatezone/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_privatezone (\S+) (\S+)/mk_sitezone -o $2/;
+ }
+ elsif ( $new_section->{$section}->{$key} =~ /mk_sourceslist/ ) {
+ $new_section->{$section}->{$key} =~ s/mk_sourceslist -s (\S+) -d (\S+)--host (\S+)/mk_sourceslist -h $2 -o $1/;
+ }
+ }
+ }
+ return $new_section;
+}
+
+sub Translate_old2new_network ($$) {
+ my ( $network_parsed, $network_name ) = @_;
+ my $new_network;
+
+ if ( $network_parsed->{'type'} ne 'network' ) {
+ Warn ( $CODE->{'INVALID_CONTEXT'}, "Unable to translate into new format a section which is not a network declaration" );
+ return;
+ }
+ my $net = new NetAddr::IP ( $network_parsed->{'network'}, $network_parsed->{'netmask'} );
+ if ( ! defined $net ) {
+ Warn ( $CODE->{'INVALID_VALUE'}, "Invalid network definition for network name ".$network_name );
+ return;
+ }
+ $new_network = {
+ 'type' => 'network',
+ 'comment' => $network_parsed->{'comment'},
+ 'network' => $net->cidr(),
+ 'tag' => $network_parsed->{'tag'},
+ 'site' => 'UNDEFINED',
+ 'scope' => ( $network_parsed->{'network_parsed'} =~ /^10\./ ) ? 'private' : 'public'
+ };
+ return $new_network;
+}
+
+sub Translate_old2new_host ($$) {
+ my ( $host_parsed, $hostname ) = @_;
+ my $new_host = {};
+
+ if ( $host_parsed->{'type'} !~ /-server$/ ) {
+ Warn ( $CODE->{'INVALID_CONTEXT'}, "Unable to translate into new format a section which is not a host declaration" );
+ return;
+ }
+
+ $new_host->{'hostgroup'}->{'hostname'} = $hostname;
+ $new_host->{'hostgroup'}->{'comment'} = $host_parsed->{'comment'} || "";
+ foreach my $key ( keys %{$host_parsed} ) {
+ if ( $key eq 'shortname' ) {
+ $new_host->{'dns'}->{'shortname'} = $host_parsed->{'shortname'};
+ }
+ elsif ( $key eq 'ether' ) {
+ foreach my $num ( sort keys %{$host_parsed->{'ether'}} ) {
+ $new_host->{'interface::eth0'}->{'mac.'.$num} = $host_parsed->{$key}->{$num};
+ }
+ }
+ elsif ( $key =~ /^arch|distrib|deploymode$/ ) {
+ my $new_key = ( $key eq 'deploymode' ) ? 'mode' : $key;
+ if ( ref $host_parsed->{$key} eq 'HASH' ) {
+ foreach my $subkey ( keys %{$host_parsed->{$key}} ) {
+ if ( $subkey eq 'default' ) {
+ $new_host->{'deployment'}->{$new_key} = $host_parsed->{$key}->{$subkey};
+ }
+ else {
+ $new_host->{'deployment'}->{$new_key.'.'.$subkey} = $host_parsed->{$key}->{$subkey};
+ }
+ }
+ }
+ else {
+ $new_host->{'deployment'}->{$new_key} = $host_parsed->{$key};
+ }
+ }
+ elsif ( $key =~ /^order|number$/ ) {
+ $new_host->{'hostgroup'}->{$key} = $host_parsed->{$key};
+ }
+ elsif ( $key eq 'interface' ) {
+ foreach my $iface ( keys %{$host_parsed->{$key}} ){
+ my $vlan = $host_parsed->{$key}->{$iface};
+ $new_host->{'interface::'.$iface}->{'vlan'} = $vlan;
+ if ( defined $host_parsed->{'ipstart'}->{$vlan} ) {
+ $new_host->{'interface::'.$iface}->{'ipv4'} = $host_parsed->{'ipstart'}->{$vlan};
+ }
+ elsif ( defined $host_parsed->{'ip'}->{$vlan} ) {
+ foreach my $subkey ( keys %{$host_parsed->{'ip'}->{$vlan}} ) {
+ if ( $subkey eq 'default' && ! defined $new_host->{'interface::'.$iface}->{'ipv4'} ) {
+ $new_host->{'interface::'.$iface}->{'ipv4'} = $host_parsed->{'ip'}->{$vlan}->{$subkey};
+ }
+ else {
+ $new_host->{'interface::'.$iface}->{'ipv4.'.$subkey} = $host_parsed->{'ip'}->{$vlan}->{$subkey};
+ }
+ }
+ }
+ else {
+ $new_host->{'interface::'.$iface}->{'ipv4'} = $host_parsed->{'ipstart'}->{'default'};
+ }
+ if ( defined $host_parsed->{$iface} ) {
+ foreach my $route ( keys %{$host_parsed->{$iface}} ) {
+ if ( ref $host_parsed->{$iface}->{$route} eq 'HASH' ) {
+ foreach my $subkey ( keys %{$host_parsed->{$iface}->{$route}} ) {
+ if ( $subkey eq 'default' ) {
+ push ( @{$new_host->{'interface::'.$iface}->{'@route'}}, $host_parsed->{$iface}->{$route}->{$subkey} );
+ }
+ else {
+ push ( @{$new_host->{'interface::'.$iface}->{'@route.'.$subkey}}, $host_parsed->{$iface}->{$route}->{$subkey} );
+ }
+ }
+ }
+ }
+ if ( $iface =~ /^bond/ ) {
+ if ( ref $host_parsed->{'bonding'}->{$iface} eq 'HASH' ) {
+ foreach my $subkey ( keys %{$host_parsed->{'bonding'}->{$iface}} ) {
+ if ( $subkey eq 'default' ) {
+ $new_host->{'interface::'.$iface}->{'slaves'} = $host_parsed->{'bonding'}->{$iface}->{$subkey};
+ }
+ else {
+ $new_host->{'interface::'.$iface}->{'slaves.'.$subkey} = $host_parsed->{'bonding'}->{$iface}->{$subkey};
+ }
+ }
+ }
+ else {
+ $new_host->{'interface::'.$iface}->{'slaves'} = $host_parsed->{'bonding'}->{$iface};
+ }
+ my $ref_cmdline = {};
+ if ( ref $host_parsed->{'cmdline'} eq 'HASH' ) {
+ $ref_cmdline = $host_parsed->{'cmdline'};
+ } else {
+ $ref_cmdline->{'default'} = $host_parsed->{'cmdline'};
+ }
+ foreach my $cmdline ( keys %{$ref_cmdline} ) {
+ my $newcmd_key = ( $cmdline eq 'default' ) ? 'cmdline' : 'cmdline.'.$cmdline;
+ my $newopt_key = ( $cmdline eq 'default' ) ? 'options' : 'options.'.$cmdline;
+ my $newmode_key = ( $cmdline eq 'default' ) ? 'mode' : 'mode.'.$cmdline;
+ foreach my $cmd ( split ( / /, $ref_cmdline->{$cmdline} ) ) {
+ if ( $cmd =~ /^bonding\.(.+)$/ ) {
+ my ( $opt, $val ) = split ( /=/, $1 );
+ my $new_opt;
+ if ( $opt eq 'mode' ) {
+ $new_host->{'interface::'.$iface}->{$newmode_key} = $val;
+ }
+ else {
+ $new_host->{'interface::'.$iface}->{$newopt_key} = $opt.'='.$val.' ';
+ }
+ }
+ else {
+ $new_host->{'boot'}->{$newcmd_key} .= $cmd." ";
+ }
+ }
+ $new_host->{'interface::'.$iface}->{$newopt_key} =~ s/\s*$//;
+ $new_host->{'boot'}->{$newcmd_key} =~ s/\s*$// if ( $new_host->{'boot'}->{$newcmd_key} );
+ }
+ }
+ }
+ }
+ }
+ elsif ( $key eq 'alias' ) {
+ foreach my $alias ( keys %{$host_parsed->{$key}} ) {
+ $new_host->{'dns'}->{'alias.'.$alias} = $host_parsed->{$key}->{$alias};
+ }
+ }
+ elsif ( $key eq 'dns' ) {
+ if ( ref $host_parsed->{$key} eq 'HASH' ) {
+ foreach my $subkey ( keys %{$host_parsed->{$key}} ) {
+ my $new_key = ( $subkey eq 'default' ) ? 'resolver' : 'resolver.'.$subkey;
+ $new_host->{'dns'}->{$new_key} = $host_parsed->{$key}->{$subkey};
+ }
+ }
+ else {
+ $new_host->{'dns'}->{'resolver'} = $host_parsed->{$key};
+ }
+ }
+ elsif ( $key =~ /^console|(pxe|uml)?filename$/ ) {
+ my $new_key;
+ if ( defined $1 ) {
+ $new_key = ( $1 eq 'uml' ) ? 'kerneluml' : 'kernel';
+ }
+ elsif ( $key eq 'filename' ) {
+ $new_key = 'pxefilename';
+ }
+ else {
+ $new_key = $key;
+ }
+ if ( ref $host_parsed->{$key} eq 'HASH' ) {
+ foreach my $subkey ( keys %{$host_parsed->{$key}} ) {
+ my $newsub_key = ( $subkey eq 'default' ) ? $new_key : $new_key.'.'.$subkey;
+ $new_host->{'boot'}->{$newsub_key} = $host_parsed->{$key}->{$subkey};
+ }
+ }
+ else {
+ $new_host->{'boot'}->{$new_key} = $host_parsed->{$key};
+ }
+ }
+ }
+ return $new_host;
+}
+
+1;
Propchange: branches/next-gen/lib/PFTools/Translation.pm
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Tue Aug 24 05:18:32 2010
@@ -1,0 +1,2 @@
+Id
+Revision
Modified: branches/next-gen/lib/PFTools/Utils.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Utils.pm?rev=836&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Utils.pm (original)
+++ branches/next-gen/lib/PFTools/Utils.pm Tue Aug 24 05:18:32 2010
@@ -75,8 +75,8 @@
#########################################################################
# Functions
-sub Init_TOOLS ($$$) {
- my ( $hostname, $pf_config_file, $global_store_file ) = @_;
+sub Init_TOOLS ($$$;$) {
+ my ( $hostname, $pf_config_file, $global_store_file, $reload ) = @_;
my ( $pf_config, $global_struct );
if ( $pf_config_file ne '' ) {
@@ -96,7 +96,8 @@
}
$global_store_file = $pf_config->{'path'}->{'global_struct'} if ( $global_store_file eq '' );
- if ( ! -e $global_store_file ) {
+ if ( ! -e $global_store_file || $reload ) {
+ print "Forcing reload or no storable available\n";
my $source = Get_source ( 'COMMON:/'.$pf_config->{'path'}->{'start_file'}, $hostname, {}, $pf_config );
if ( ! -e $source ) {
Set_deferredlog ();
Modified: branches/next-gen/sbin/mk_dhcp
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_dhcp?rev=836&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_dhcp (original)
+++ branches/next-gen/sbin/mk_dhcp Tue Aug 24 05:18:32 2010
@@ -57,7 +57,7 @@
-s --site : site on which hostname is defined
--store : file where global structure datas are in storable format (optional)
-c --config : pf-tools config file (optional)
- -o --output : output file default value is /etc/network/interfaces
+ -o --output : output file
# ENDHELP
}
Modified: branches/next-gen/sbin/mk_grubopt
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_grubopt?rev=836&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_grubopt (original)
+++ branches/next-gen/sbin/mk_grubopt Tue Aug 24 05:18:32 2010
@@ -60,7 +60,7 @@
-h --host : the hostname for which you want to build grub configuration
-s --site : the site where the hostname is defined
--src : the source for grub configuration
- --grub : version of brub default value is 2
+ --grub : version of grub default value is 2
-o --output : destination for modified GRUB configuration
--store : path for accessing storable file containing the global configuration
-c --config : path for accessing pf-tools.conf file
Modified: branches/next-gen/sbin/mk_sitezone
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_sitezone?rev=836&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_sitezone (original)
+++ branches/next-gen/sbin/mk_sitezone Tue Aug 24 05:18:32 2010
@@ -56,7 +56,7 @@
-s --site : site on which hostname is defined
--store : file where global structure datas are in storable format (optional)
-c --config : pf-tools config file (optional)
- -o --output : output file default value is /etc/network/interfaces
+ -o --output : output file
# ENDHELP
}
Modified: branches/next-gen/sbin/update-config
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/update-config?rev=836&op=diff
==============================================================================
--- branches/next-gen/sbin/update-config (original)
+++ branches/next-gen/sbin/update-config Tue Aug 24 05:18:32 2010
@@ -77,6 +77,7 @@
'branch=s',
'debug|d',
'diff|u',
+ 'force-reload|f',
'help',
'install|i',
'noaction',
@@ -99,7 +100,7 @@
my $HOSTNAME = $options->{'host'} || hostname;
my $SITE = $options->{'site'} || "";
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $options->{'config'}, $options->{'store'} );
+( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $options->{'config'}, $options->{'store'}, $options->{'force-reload'} );
#### VERIFYING UPDATE FEATURE IN PF-TOOLS CONFIG ABORTING IF DEACTIVATED !!!
if ( ! $PF_CONFIG->{'features'}->{'update'} ) {
More information about the pf-tools-commits
mailing list