pf-tools commit: r837 [ccaillet-guest] - in /branches/next-gen: debian/changelog lib/PFTools/Translation.pm lib/PFTools/Utils.pm sbin/mk_dhcp sbin/mk_pxelinuxcfg sbin/mk_sitezone
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Tue Aug 24 08:04:57 UTC 2010
Author: ccaillet-guest
Date: Tue Aug 24 08:04:54 2010
New Revision: 837
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=837
Log:
* sbin/mk_pxelinuxcfg
- fix: correctly handle the site parameter f it is not defined on CLI
* sbin/mk_dhcp
- fix: correctly handle the site parameter f it is not defined on CLI
* sbin/mk_sitezone
- fix: correctly handle the site parameter f it is not defined on CLI
Modified:
branches/next-gen/debian/changelog
branches/next-gen/lib/PFTools/Translation.pm
branches/next-gen/lib/PFTools/Utils.pm
branches/next-gen/sbin/mk_dhcp
branches/next-gen/sbin/mk_pxelinuxcfg
branches/next-gen/sbin/mk_sitezone
Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=837&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Tue Aug 24 08:04:54 2010
@@ -7,6 +7,12 @@
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
+ * sbin/mk_pxelinuxcfg
+ - fix: correctly handle the site parameter f it is not defined on CLI
+ * sbin/mk_dhcp
+ - fix: correctly handle the site parameter f it is not defined on CLI
+ * sbin/mk_sitezone
+ - fix: correctly handle the site parameter f it is not defined on CLI
* 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
@@ -42,7 +48,7 @@
* doc/updatefile-syntax
- basic documentation about update file
- -- Christophe Caillet <tof at sitadelle.com> Tue, 24 Aug 2010 07:10:10 +0200
+ -- Christophe Caillet <quadchris at free.fr> Tue, 24 Aug 2010 08:21:24 +0200
pf-tools (0.99.98-1) unstable; urgency=low
Modified: branches/next-gen/lib/PFTools/Translation.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Translation.pm?rev=837&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Translation.pm (original)
+++ branches/next-gen/lib/PFTools/Translation.pm Tue Aug 24 08:04:54 2010
@@ -29,6 +29,7 @@
our @EXPORT = qw (
Translate_old2new_host
Translate_old2new_network
+ Translate_old2new_config
);
our @EXPORT_OK = qw();
@@ -37,41 +38,43 @@
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}} ) {
+sub Translate_old2new_config ($) {
+ my ( $conf_parsed ) = @_;
+
+ my $new_conf = $conf_parsed;
+ foreach my $section ( keys %{$new_conf} ) {
+ foreach my $key ( keys %{$new_conf->{$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;
+ $new_conf->{$section}->{$key} =~ s/(filter_(\S+)) (\S+) (\S+) (\S+)/$1 -i $3 -h $4 -o $5/g;
+ $new_conf->{$section}->{$key} =~ s/^apt-get$/installpkg/;
+ $new_conf->{$section}->{$key} =~ s/^dpkg-purge$/purgepkg/;
+ if ( $new_conf->{$section}->{$key} =~ /mk_pxelinuxcfg/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_pxelinuxcfg (\S+) (\S+)/mk_pxelinuxcfg/;
+ }
+ elsif ( $new_conf->{$section}->{$key} =~ /mk_grubopt/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_grubopt -d (\S+) --host (\S+)/mk_grubopt -h $2 -o $1 --grub 1/;
+ }
+ elsif ( $new_conf->{$section}->{$key} =~ /mk_grub2opt/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_grubopt -d (\S+) --host (\S+)/mk_grubopt -h $2 -o $1/;
+ }
+ elsif ( $new_conf->{$section}->{$key} =~ /mk_resolvconf/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_resolvconf (\S+) (\S+) (\S+)/mk_resolvconf -h $2 -o $3/;
+ }
+ elsif ( $new_conf->{$section}->{$key} =~ /mk_interfaces/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_interfaces (\S+) (\S+) (\S+)/mk_interfaces -h $2 -o $3/;
+ }
+ elsif ( $new_conf->{$section}->{$key} =~ /mk_dhcp/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_dhcp (\S+) (\S+) (\S+)/mk_dhcp -H $1 -o $3/;
+ }
+ elsif ( $new_conf->{$section}->{$key} =~ /mk_privatezone/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_privatezone (\S+) (\S+)/mk_sitezone -o $2/;
+ }
+ elsif ( $new_conf->{$section}->{$key} =~ /mk_sourceslist/ ) {
+ $new_conf->{$section}->{$key} =~ s/mk_sourceslist -s (\S+) -d (\S+)--host (\S+)/mk_sourceslist -h $2 -o $1/;
+ }
+ }
+ }
+ return $new_conf;
}
sub Translate_old2new_network ($$) {
Modified: branches/next-gen/lib/PFTools/Utils.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Utils.pm?rev=837&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Utils.pm (original)
+++ branches/next-gen/lib/PFTools/Utils.pm Tue Aug 24 08:04:54 2010
@@ -96,7 +96,7 @@
}
$global_store_file = $pf_config->{'path'}->{'global_struct'} if ( $global_store_file eq '' );
- if ( ! -e $global_store_file || $reload ) {
+ if ( ! -e $global_store_file || ( defined $reload && $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 ) {
Modified: branches/next-gen/sbin/mk_dhcp
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_dhcp?rev=837&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_dhcp (original)
+++ branches/next-gen/sbin/mk_dhcp Tue Aug 24 08:04:54 2010
@@ -81,22 +81,27 @@
( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
-if ( $SITE eq '' && ! defined $PF_CONFIG->{'location'}->{'site'} ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "A site MUST BE defined for building DNS zone forward" );
+if ( $SITE eq '' ) {
+ if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
+ Abort ( $CODE->{'UNDEF_KEY'},
+ "A site MUST BE defined for building DNS zone forward" );
+ }
+ else {
+ $SITE = $PF_CONFIG->{'location'}->{'site'};
+ }
}
-elsif ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
+
+if ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
Abort ( $CODE->{'UNDEF_KEY'},
"Site ".$SITE." is not defined into global configuration" );
}
-else {
- my $DHCP = Mk_dhcp ( $HEADER, $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} );
- unless ( open ( DHCP, ">".$OUTPUT_FILE ) ) {
- Abort ( $CODE->{'OPEN'},
- "Unable to open zone file ".$OUTPUT_FILE );
- }
- print DHCP join ( "\n", @{$DHCP} );
- close ( DHCP );
+
+my $DHCP = Mk_dhcp ( $HEADER, $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} );
+unless ( open ( DHCP, ">".$OUTPUT_FILE ) ) {
+ Abort ( $CODE->{'OPEN'},
+ "Unable to open zone file ".$OUTPUT_FILE );
}
+print DHCP join ( "\n", @{$DHCP} );
+close ( DHCP );
exit 0;
Modified: branches/next-gen/sbin/mk_pxelinuxcfg
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_pxelinuxcfg?rev=837&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_pxelinuxcfg (original)
+++ branches/next-gen/sbin/mk_pxelinuxcfg Tue Aug 24 08:04:54 2010
@@ -93,11 +93,17 @@
chmod ( oct ( $mode ), $PF_CONFIG->{'path'}->{'preseed_dir'} ) ;
}
$DEFAULT_PRESEED = $PF_CONFIG->{'path'}->{'preseed_dir'}."/default_preseed.txt" ;
-if ( $SITE eq '' && ! defined $PF_CONFIG->{'location'}->{'site'} ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "A site MUST BE defined for building DNS zone forward" );
+if ( $SITE eq '' ) {
+ if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
+ Abort ( $CODE->{'UNDEF_KEY'},
+ "A site MUST BE defined for building DNS zone forward" );
+ }
+ else {
+ $SITE = $PF_CONFIG->{'location'}->{'site'};
+ }
}
-elsif ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
+
+if ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
Abort ( $CODE->{'UNDEF_KEY'},
"Site ".$SITE." is not defined into global configuration" );
}
Modified: branches/next-gen/sbin/mk_sitezone
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/sbin/mk_sitezone?rev=837&op=diff
==============================================================================
--- branches/next-gen/sbin/mk_sitezone (original)
+++ branches/next-gen/sbin/mk_sitezone Tue Aug 24 08:04:54 2010
@@ -79,22 +79,27 @@
( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( "", $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
-if ( $SITE eq '' && ! defined $PF_CONFIG->{'location'}->{'site'} ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "A site MUST BE defined for building DNS zone forward" );
+if ( $SITE eq '' ) {
+ if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
+ Abort ( $CODE->{'UNDEF_KEY'},
+ "A site MUST BE defined for building DNS zone forward" );
+ }
+ else {
+ $SITE = $PF_CONFIG->{'location'}->{'site'};
+ }
}
-elsif ( ! defined $GLOBAL_STRUCT->{'SITE'}->{'BY_NAME'}->{$SITE} ) {
+
+if ( ! defined $GLOBAL_STRUCT->{'DHCP'}->{'BY_SITE'}->{$SITE} ) {
Abort ( $CODE->{'UNDEF_KEY'},
"Site ".$SITE." is not defined into global configuration" );
}
-else {
- my $zone = Mk_zone_for_site ( $GLOBAL_STRUCT->{'SITE'}->{'BY_NAME'}->{$SITE}->{'zone'}, $SITE, $GLOBAL_STRUCT );
- unless ( open ( ZONE, ">".$OUTPUT_FILE ) ) {
- Abort ( $CODE->{'OPEN'},
- "Unable to open zone file ".$OUTPUT_FILE );
- }
- print ZONE join ( "\n", @{$zone} );
- close ( ZONE );
+
+my $zone = Mk_zone_for_site ( $GLOBAL_STRUCT->{'SITE'}->{'BY_NAME'}->{$SITE}->{'zone'}, $SITE, $GLOBAL_STRUCT );
+unless ( open ( ZONE, ">".$OUTPUT_FILE ) ) {
+ Abort ( $CODE->{'OPEN'},
+ "Unable to open zone file ".$OUTPUT_FILE );
}
+print ZONE join ( "\n", @{$zone} );
+close ( ZONE );
exit 0;
More information about the pf-tools-commits
mailing list