pf-tools commit: r840 [ccaillet-guest] - in /branches/next-gen: debian/changelog lib/PFTools/Utils.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Tue Aug 24 13:13:58 UTC 2010


Author: ccaillet-guest
Date: Tue Aug 24 13:13:54 2010
New Revision: 840

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=840
Log:
cosmetic for building zone in __Mk_zoneheader and Mk_zone_for_site

Modified:
    branches/next-gen/debian/changelog
    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=840&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Tue Aug 24 13:13:54 2010
@@ -18,6 +18,7 @@
     - rollback for CONFIG: alias with the 0.33-stable substitution value
   * 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
   * lib/PFTools/Update.pm
     - splitting $FUNCTION and $DEPENDS to perl package under PFTools::Update::*
     - privatizing __Trie_prio and fix for action installpkg or purgepkg
@@ -49,7 +50,7 @@
   * doc/updatefile-syntax
     - basic documentation about update file
 
- -- Christophe Caillet <quadchris at free.fr>  Tue, 24 Aug 2010 10:42:50 +0200
+ -- Christophe Caillet <tof at sitadelle.com>  Tue, 24 Aug 2010 15:08:46 +0200
 
 pf-tools (0.99.98-1) unstable; urgency=low
 

Modified: branches/next-gen/lib/PFTools/Utils.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Utils.pm?rev=840&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Utils.pm (original)
+++ branches/next-gen/lib/PFTools/Utils.pm Tue Aug 24 13:13:54 2010
@@ -375,35 +375,28 @@
 	push ( @{$zone_result}, ";; Site : ".$zone_site );
 	push ( @{$zone_result}, ";;" );
 	push ( @{$zone_result}, ";; ".$zone_part->{'SOA'}->{'comment'} );
-	push ( @{$zone_result}, "\n;;============================================================================\n" );
-	push ( @{$zone_result}, "\$TTL ".$zone_part->{'SOA'}->{'ttl'} );
-	push ( @{$zone_result}, "\@\t\tIN SOA ".$zone_part->{'SOA'}->{'soa'}." ".$zone_part->{'SOA'}->{'mail'}." (" );
+	push ( @{$zone_result}, ";;============================================================================\n" );
+	push ( @{$zone_result}, sprintf ( "\$TTL %s", $zone_part->{'SOA'}->{'ttl'} ) );
+	push ( @{$zone_result}, sprintf ( "%-29s IN SOA\t%s %s (", '@', $zone_part->{'SOA'}->{'soa'}, $zone_part->{'SOA'}->{'mail'} ) );
 	my $serial =  ( $zone_part->{'SOA'}->{'serial'} eq 'AUTO' ) ? time."\t; Serial" : $zone_part->{'SOA'}->{'serial'};
-	push ( @{$zone_result}, "\t\t\t".$serial );
+	push ( @{$zone_result}, sprintf ( "%-30s%s", '', $serial ) );
 	foreach my $spec ( 'refresh', 'retry', 'expire', 'negttl' ) {
-		push ( @{$zone_result}, "\t\t\t".$zone_part->{'SOA'}->{$spec} );
-	}
-	push ( @{$zone_result}, "\t\t)" );
-	push ( @{$zone_result}, "\n" );
+		push ( @{$zone_result}, sprintf ( "%-30s%s", '', $zone_part->{'SOA'}->{$spec} ));
+	}
+	push ( @{$zone_result}, sprintf "%-30s%s\n", '', ')' );
 	# NS fields
 	foreach my $nameserver ( @{ $zone_part->{'SOA'}->{'@ns'} } ) {
-		push ( @{$zone_result}, "\t\tIN NS\t".$nameserver );
-	}
-	push ( @{$zone_result}, "\n" );
+		push ( @{$zone_result}, sprintf ( "%-29s IN NS\t%s", '', $nameserver ) );
+	}
+	push ( @{$zone_result}, "" );
 	# MX fields
 	foreach my $mx ( @{ $zone_part->{'SOA'}->{'@mx'} } ) {
-		push ( @{$zone_result}, "\t\tIN MX\t".$mx );
+		push ( @{$zone_result}, sprintf ( "%-29s IN MX\t%s", '', $mx ) );
 	}
 	push ( @{$zone_result}, "\n" );
 	return $zone_result;
 }
 
-#
-#	VOID Mk_zone (STRING $fic_zone, HASHREF $Z)
-#
-#	Construit un le fichier $fic_zone pour la zone DNS decrite par la structure $Z
-#
-#==============================================================================================
 sub Mk_zone_for_site ($$$) {
     my ( $zone_name, $zone_site, $global_config ) = @_;
 	my $zone_result	= [];
@@ -413,7 +406,7 @@
 	my $zone_part	= $global_config->{'ZONE'}->{'BY_NAME'}->{$zone_name}->{'BY_SITE'}->{$zone_site};
 
 	### Building Networks part
-	push ( @{$zone_result}, "\n\n;;" );
+	push ( @{$zone_result}, ";;" );
 	push ( @{$zone_result}, ";; Networks" );
 	push ( @{$zone_result}, ";;============================================================================\n" );
 
@@ -424,7 +417,7 @@
 		push ( @{$zone_result}, ";----------------------------------------------------------------------------" );
 		foreach my $spec ( 'network', 'netmask', 'broadcast', 'gateway' ) {
 			next if ( ! defined $zone_part->{$network}->{$spec} );
-			push ( @{$zone_result}, $spec.".".$network."\t\t".$zone_part->{$network}->{$spec} );
+			push ( @{$zone_result}, sprintf ( "%-29s IN %s", $spec.".".$network, $zone_part->{$network}->{$spec} ) );
 		}
 		push ( @{$zone_result}, "" );
 	}
@@ -443,11 +436,11 @@
 			next if ( $field eq 'comment' );
 			if ( ref $zone_part->{$server}->{$field} eq 'ARRAY' ) {
 				foreach my $elt ( @{$zone_part->{$server}->{$field}} ) {
-					push ( @{$zone_result}, $field."\t\t".$elt );
+					push ( @{$zone_result}, sprintf ( "%-29s IN %s", $field, $elt ) );
 				}
 			}
 			else {
-				push ( @{$zone_result}, $field."\t".$zone_part->{$server}->{$field} );
+				push ( @{$zone_result}, sprintf ( "%-29s IN %s", $field, $zone_part->{$server}->{$field} ) );
 			}
 		}
 		push ( @{$zone_result}, "" );




More information about the pf-tools-commits mailing list