pf-tools commit: r878 [parmelan-guest] - in /branches/next-gen/filters: filter_distrib filter_privateresolve filter_vlan2if
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Tue Sep 7 08:54:27 UTC 2010
Author: parmelan-guest
Date: Tue Sep 7 08:54:24 2010
New Revision: 878
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=878
Log:
perltidy filters
Modified:
branches/next-gen/filters/filter_distrib (contents, props changed)
branches/next-gen/filters/filter_privateresolve (contents, props changed)
branches/next-gen/filters/filter_vlan2if (contents, props changed)
Modified: branches/next-gen/filters/filter_distrib
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/filters/filter_distrib?rev=878&op=diff
==============================================================================
--- branches/next-gen/filters/filter_distrib (original)
+++ branches/next-gen/filters/filter_distrib Tue Sep 7 08:54:24 2010
@@ -30,18 +30,18 @@
#################################
# VARS
-my $HELP = 0;
-my $HOSTNAME = hostname;
-my $SITE = '';
-my $GLOBAL_STORE_FILE = '';
-my $PF_CONFIG_FILE = '';
-my $PF_CONFIG = {};
-my $INPUT_FILE = '';
-my $OUTPUT_FILE = '';
-my $GLOBAL_STRUCT = {};
+my $HELP = 0;
+my $HOSTNAME = hostname;
+my $SITE = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE = '';
+my $PF_CONFIG = {};
+my $INPUT_FILE = '';
+my $OUTPUT_FILE = '';
+my $GLOBAL_STRUCT = {};
my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%; # cheap basename
my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
@@ -67,58 +67,65 @@
##################################
### MAIN
-GetOptions (
- 'help' => \$HELP,
- 'host|h=s' => \$HOSTNAME,
- 'site|s=s' => \$SITE,
- 'config|c=s' => \$PF_CONFIG_FILE,
- 'store=s' => \$GLOBAL_STORE_FILE,
- 'input|i=s' => \$INPUT_FILE,
- 'output|o=s' => \$OUTPUT_FILE
+GetOptions(
+ 'help' => \$HELP,
+ 'host|h=s' => \$HOSTNAME,
+ 'site|s=s' => \$SITE,
+ 'config|c=s' => \$PF_CONFIG_FILE,
+ 'store=s' => \$GLOBAL_STORE_FILE,
+ 'input|i=s' => \$INPUT_FILE,
+ 'output|o=s' => \$OUTPUT_FILE
) or die "Didn't grok options (see --help).\n";
-if ( $HELP ) {
- Do_help ();
- exit 0;
+if ($HELP) {
+ Do_help();
+ exit 0;
}
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+ = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
if ( $SITE eq '' ) {
- if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
- my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
- if ( ! defined $site_list ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
- }
- elsif ( scalar @{$site_list} > 1 ) {
- Abort ( $CODE->{'DUPLICATE_VALUE'},
- "Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
- .join ( ",", @{$site_list} ).".\n"
- ."Please relaunch this command with the right site" );
- }
- else {
- ( $SITE ) = @{$site_list};
- }
- }
- else {
- $SITE = $PF_CONFIG->{'location'}->{'site'}
- }
+ if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+ my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+ if ( !defined $site_list ) {
+ Abort( $CODE->{'UNDEF_KEY'},
+ "Unable to retrieve site for hostname "
+ . $HOSTNAME
+ . " : hostname not defined" );
+ }
+ elsif ( scalar @{$site_list} > 1 ) {
+ Abort( $CODE->{'DUPLICATE_VALUE'},
+ "Unable to retrieve site for hostname "
+ . $HOSTNAME
+ . " : hostname appeared in multiple sites : "
+ . join( ",", @{$site_list} ) . ".\n"
+ . "Please relaunch this command with the right site" );
+ }
+ else {
+ ($SITE) = @{$site_list};
+ }
+ }
+ else {
+ $SITE = $PF_CONFIG->{'location'}->{'site'};
+ }
}
if ( $INPUT_FILE eq '' || $OUTPUT_FILE eq '' ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "Source and/or destination file is(are) not defined on CLI" );
+ Abort( $CODE->{'UNDEF_KEY'},
+ "Source and/or destination file is(are) not defined on CLI" );
}
-my $filtered_src = Search_and_replace ( $HOSTNAME, $SITE, $INPUT_FILE, 'distrib', $PF_CONFIG, "", $GLOBAL_STRUCT );
+my $filtered_src
+ = Search_and_replace( $HOSTNAME, $SITE, $INPUT_FILE, 'distrib',
+ $PF_CONFIG, "", $GLOBAL_STRUCT );
-unless ( open ( OUTPUT, ">".$OUTPUT_FILE ) ) {
- Abort ( $CODE->{'OPEN'},
- "Unable to open destination file ".$OUTPUT_FILE." : $!" );
+unless ( open( OUTPUT, ">" . $OUTPUT_FILE ) ) {
+ Abort( $CODE->{'OPEN'},
+ "Unable to open destination file " . $OUTPUT_FILE . " : $!" );
}
-print OUTPUT join ( "", @{$filtered_src} );
-close ( OUTPUT );
+print OUTPUT join( "", @{$filtered_src} );
+close(OUTPUT);
exit 0;
Modified: branches/next-gen/filters/filter_privateresolve
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/filters/filter_privateresolve?rev=878&op=diff
==============================================================================
--- branches/next-gen/filters/filter_privateresolve (original)
+++ branches/next-gen/filters/filter_privateresolve Tue Sep 7 08:54:24 2010
@@ -33,21 +33,21 @@
#################################
# VARS
-my $HELP = 0;
-my $HOSTNAME = hostname;
-my $SITE = '';
-my $GLOBAL_STORE_FILE = '';
-my $PF_CONFIG_FILE = '';
-my $PF_CONFIG = {};
-my $TYPE_RESOLVE = 'cnf';
-my $SEPARATOR = " ";
-my $ZONE = "";
-my $INPUT_FILE = '';
-my $OUTPUT_FILE = '';
-my $GLOBAL_STRUCT = {};
+my $HELP = 0;
+my $HOSTNAME = hostname;
+my $SITE = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE = '';
+my $PF_CONFIG = {};
+my $TYPE_RESOLVE = 'cnf';
+my $SEPARATOR = " ";
+my $ZONE = "";
+my $INPUT_FILE = '';
+my $OUTPUT_FILE = '';
+my $GLOBAL_STRUCT = {};
my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%; # cheap basename
my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
@@ -76,63 +76,70 @@
##################################
### MAIN
-GetOptions (
- 'help' => \$HELP,
- 'host|h=s' => \$HOSTNAME,
- 'site|s=s' => \$SITE,
- 'config|c=s' => \$PF_CONFIG_FILE,
- 'store=s' => \$GLOBAL_STORE_FILE,
- 'type|t=s' => \$TYPE_RESOLVE,
- 'sep=s' => \$SEPARATOR,
- 'zone|z=s' => \$ZONE,
- 'input|i=s' => \$INPUT_FILE,
- 'output|o=s' => \$OUTPUT_FILE
+GetOptions(
+ 'help' => \$HELP,
+ 'host|h=s' => \$HOSTNAME,
+ 'site|s=s' => \$SITE,
+ 'config|c=s' => \$PF_CONFIG_FILE,
+ 'store=s' => \$GLOBAL_STORE_FILE,
+ 'type|t=s' => \$TYPE_RESOLVE,
+ 'sep=s' => \$SEPARATOR,
+ 'zone|z=s' => \$ZONE,
+ 'input|i=s' => \$INPUT_FILE,
+ 'output|o=s' => \$OUTPUT_FILE
) or die "Didn't grok options (see --help).\n";
-if ( $HELP ) {
- Do_help ();
- exit 0;
+if ($HELP) {
+ Do_help();
+ exit 0;
}
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+ = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
if ( $SITE eq '' ) {
- if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
- my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
- if ( ! defined $site_list ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
- }
- elsif ( scalar @{$site_list} > 1 ) {
- Abort ( $CODE->{'DUPLICATE_VALUE'},
- "Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
- .join ( ",", @{$site_list} ).".\n"
- ."Please relaunch this command with the right site" );
- }
- else {
- ( $SITE ) = @{$site_list};
- }
- }
- else {
- $SITE = $PF_CONFIG->{'location'}->{'site'}
- }
+ if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+ my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+ if ( !defined $site_list ) {
+ Abort( $CODE->{'UNDEF_KEY'},
+ "Unable to retrieve site for hostname "
+ . $HOSTNAME
+ . " : hostname not defined" );
+ }
+ elsif ( scalar @{$site_list} > 1 ) {
+ Abort( $CODE->{'DUPLICATE_VALUE'},
+ "Unable to retrieve site for hostname "
+ . $HOSTNAME
+ . " : hostname appeared in multiple sites : "
+ . join( ",", @{$site_list} ) . ".\n"
+ . "Please relaunch this command with the right site" );
+ }
+ else {
+ ($SITE) = @{$site_list};
+ }
+ }
+ else {
+ $SITE = $PF_CONFIG->{'location'}->{'site'};
+ }
}
-$ZONE = Get_zone_from_site_GLOBAL ( $SITE, $GLOBAL_STRUCT ) if ( $ZONE eq '' );
+$ZONE = Get_zone_from_site_GLOBAL( $SITE, $GLOBAL_STRUCT ) if ( $ZONE eq '' );
if ( $INPUT_FILE eq '' || $OUTPUT_FILE eq '' ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "Source and/or destination file is(are) not defined on CLI" );
+ Abort( $CODE->{'UNDEF_KEY'},
+ "Source and/or destination file is(are) not defined on CLI" );
}
-my $filtered_src = Search_and_replace ( $HOSTNAME, $SITE, $INPUT_FILE, 'resolver', $PF_CONFIG, $SEPARATOR, $GLOBAL_STRUCT, $TYPE_RESOLVE );
+my $filtered_src
+ = Search_and_replace( $HOSTNAME, $SITE, $INPUT_FILE, 'resolver',
+ $PF_CONFIG, $SEPARATOR, $GLOBAL_STRUCT, $TYPE_RESOLVE );
-unless ( open ( OUTPUT, ">".$OUTPUT_FILE ) ) {
- Abort ( $CODE->{'OPEN'},
- "Unable to open destination file ".$OUTPUT_FILE." : $!" );
+unless ( open( OUTPUT, ">" . $OUTPUT_FILE ) ) {
+ Abort( $CODE->{'OPEN'},
+ "Unable to open destination file " . $OUTPUT_FILE . " : $!" );
}
-print OUTPUT join ( "", @{$filtered_src} );
-close ( OUTPUT );
+print OUTPUT join( "", @{$filtered_src} );
+close(OUTPUT);
exit 0;
Modified: branches/next-gen/filters/filter_vlan2if
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/filters/filter_vlan2if?rev=878&op=diff
==============================================================================
--- branches/next-gen/filters/filter_vlan2if (original)
+++ branches/next-gen/filters/filter_vlan2if Tue Sep 7 08:54:24 2010
@@ -35,18 +35,18 @@
#################################
# VARS
-my $HELP = 0;
-my $HOSTNAME = hostname;
-my $SITE = '';
-my $GLOBAL_STORE_FILE = '';
-my $PF_CONFIG_FILE = '';
-my $PF_CONFIG = {};
-my $INPUT_FILE = '';
-my $OUTPUT_FILE = '';
-my $GLOBAL_STRUCT = {};
+my $HELP = 0;
+my $HOSTNAME = hostname;
+my $SITE = '';
+my $GLOBAL_STORE_FILE = '';
+my $PF_CONFIG_FILE = '';
+my $PF_CONFIG = {};
+my $INPUT_FILE = '';
+my $OUTPUT_FILE = '';
+my $GLOBAL_STRUCT = {};
my $program = $0;
-$program =~ s%.*/%%; # cheap basename
+$program =~ s%.*/%%; # cheap basename
my $version = sprintf( "svn-r%s", q$Revision$ =~ /([\d.]+)/ );
@@ -72,58 +72,65 @@
##################################
### MAIN
-GetOptions (
- 'help' => \$HELP,
- 'host|h=s' => \$HOSTNAME,
- 'site|s=s' => \$SITE,
- 'config|c=s' => \$PF_CONFIG_FILE,
- 'store=s' => \$GLOBAL_STORE_FILE,
- 'input|i=s' => \$INPUT_FILE,
- 'output|o=s' => \$OUTPUT_FILE
+GetOptions(
+ 'help' => \$HELP,
+ 'host|h=s' => \$HOSTNAME,
+ 'site|s=s' => \$SITE,
+ 'config|c=s' => \$PF_CONFIG_FILE,
+ 'store=s' => \$GLOBAL_STORE_FILE,
+ 'input|i=s' => \$INPUT_FILE,
+ 'output|o=s' => \$OUTPUT_FILE
) or die "Didn't grok options (see --help).\n";
-if ( $HELP ) {
- Do_help ();
- exit 0;
+if ($HELP) {
+ Do_help();
+ exit 0;
}
-( $PF_CONFIG, $GLOBAL_STRUCT ) = Init_TOOLS ( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
+( $PF_CONFIG, $GLOBAL_STRUCT )
+ = Init_TOOLS( $HOSTNAME, $PF_CONFIG_FILE, $GLOBAL_STORE_FILE );
if ( $SITE eq '' ) {
- if ( ! defined $PF_CONFIG->{'location'}->{'site'} ) {
- my $site_list = Get_site_from_hostname ( $HOSTNAME, $GLOBAL_STRUCT );
- if ( ! defined $site_list ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "Unable to retrieve site for hostname ".$HOSTNAME." : hostname not defined" );
- }
- elsif ( scalar @{$site_list} > 1 ) {
- Abort ( $CODE->{'DUPLICATE_VALUE'},
- "Unable to retrieve site for hostname ".$HOSTNAME." : hostname appeared in multiple sites : "
- .join ( ",", @{$site_list} ).".\n"
- ."Please relaunch this command with the right site" );
- }
- else {
- ( $SITE ) = @{$site_list};
- }
- }
- else {
- $SITE = $PF_CONFIG->{'location'}->{'site'}
- }
+ if ( !defined $PF_CONFIG->{'location'}->{'site'} ) {
+ my $site_list = Get_site_from_hostname( $HOSTNAME, $GLOBAL_STRUCT );
+ if ( !defined $site_list ) {
+ Abort( $CODE->{'UNDEF_KEY'},
+ "Unable to retrieve site for hostname "
+ . $HOSTNAME
+ . " : hostname not defined" );
+ }
+ elsif ( scalar @{$site_list} > 1 ) {
+ Abort( $CODE->{'DUPLICATE_VALUE'},
+ "Unable to retrieve site for hostname "
+ . $HOSTNAME
+ . " : hostname appeared in multiple sites : "
+ . join( ",", @{$site_list} ) . ".\n"
+ . "Please relaunch this command with the right site" );
+ }
+ else {
+ ($SITE) = @{$site_list};
+ }
+ }
+ else {
+ $SITE = $PF_CONFIG->{'location'}->{'site'};
+ }
}
if ( $INPUT_FILE eq '' || $OUTPUT_FILE eq '' ) {
- Abort ( $CODE->{'UNDEF_KEY'},
- "Source and/or destination file is(are) not defined on CLI" );
+ Abort( $CODE->{'UNDEF_KEY'},
+ "Source and/or destination file is(are) not defined on CLI" );
}
-my $filtered_src = Search_and_replace ( $HOSTNAME, $SITE, $INPUT_FILE, 'iface', $PF_CONFIG, "", $GLOBAL_STRUCT );
+my $filtered_src
+ = Search_and_replace( $HOSTNAME, $SITE, $INPUT_FILE, 'iface', $PF_CONFIG,
+ "", $GLOBAL_STRUCT );
-unless ( open ( OUTPUT, ">".$OUTPUT_FILE ) ) {
- Abort ( $CODE->{'OPEN'},
- "Unable to open destination file ".$OUTPUT_FILE." : $!" );
+unless ( open( OUTPUT, ">" . $OUTPUT_FILE ) ) {
+ Abort( $CODE->{'OPEN'},
+ "Unable to open destination file " . $OUTPUT_FILE . " : $!" );
}
-print OUTPUT join ( "", @{$filtered_src} );
-close ( OUTPUT );
+print OUTPUT join( "", @{$filtered_src} );
+close(OUTPUT);
exit 0;
More information about the pf-tools-commits
mailing list