pf-tools commit: r804 [ccaillet-guest] - in /branches/next-gen/lib/PFTools: Conf.pm Logger.pm Net.pm Update.pm VCS.pm
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Fri Aug 6 08:38:05 UTC 2010
Author: ccaillet-guest
Date: Fri Aug 6 08:37:40 2010
New Revision: 804
URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=804
Log:
FIX: misc fixes
Modified:
branches/next-gen/lib/PFTools/Conf.pm
branches/next-gen/lib/PFTools/Logger.pm
branches/next-gen/lib/PFTools/Net.pm
branches/next-gen/lib/PFTools/Update.pm
branches/next-gen/lib/PFTools/VCS.pm
Modified: branches/next-gen/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Conf.pm?rev=804&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Conf.pm (original)
+++ branches/next-gen/lib/PFTools/Conf.pm Fri Aug 6 08:37:40 2010
@@ -324,7 +324,7 @@
'server' => 'cvs.private',
'cvsroot' => '/var/lib/cvs/repository',
'module' => 'config',
- 'umask' => '',
+ 'umask' => '0077',
'command' => '',
'branche' => ''
};
Modified: branches/next-gen/lib/PFTools/Logger.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Logger.pm?rev=804&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Logger.pm (original)
+++ branches/next-gen/lib/PFTools/Logger.pm Fri Aug 6 08:37:40 2010
@@ -33,6 +33,8 @@
deferredlogsystem
deferredlogpipe
+ Set_deferredlog
+ Unset_deferredlog
FlushLog
DelLog
Abort
@@ -45,9 +47,8 @@
our @EXPORT_OK = qw();
-# Error code
-our $ERR_OPEN = 1;
-our $ERR_SYNTAX = 2;
+my $DEFERREDLOG = 0;
+
# Error code and error messages
our $CODE = {};
$CODE->{'OK'} = 0;
@@ -81,6 +82,14 @@
= ( $rotatecursorcount + 1 ) % ( $#rotatecursortemplate + 1 );
}
+sub Set_deferredlog () {
+ $DEFERREDLOG = 1;
+}
+
+sub Unset_deferredlog () {
+ $DEFERREDLOG = 0;
+}
+
sub DeferOutput {
local *REAL_STDOUT;
@@ -138,10 +147,10 @@
my ( $pipe_cmd, $deferredlog ) = @_;
my $ret = '';
- DeferOutput() if $deferredlog;
+ DeferOutput() if ( $deferredlog || $DEFERREDLOG );
unless ( open DEFERREDLOGPIPE, '-|', $pipe_cmd ) {
- Warn( $ERR_OPEN, "Unable to open pipe $pipe_cmd : $!" );
+ Warn( $CODE->{'OPEN'}, "Unable to open pipe $pipe_cmd : $!" );
return;
}
@@ -151,7 +160,7 @@
}
close DEFERREDLOGPIPE;
- UndeferOutput() if $deferredlog;
+ UndeferOutput() if ( $deferredlog || $DEFERREDLOG );
if ($deferbuffer) {
$deferredlogbuffer .= $deferbuffer;
@@ -167,11 +176,11 @@
my ( $system_cmd, $deferredlog ) = @_;
my $ret;
- DeferOutput() if ( $deferredlog );
+ DeferOutput() if ( $deferredlog || $DEFERREDLOG );
$ret = system ( $system_cmd );
- UndeferOutput() if ( $deferredlog );
+ UndeferOutput() if ( $deferredlog || $DEFERREDLOG );
if ( defined $deferbuffer && $deferbuffer ne '' ) {
$deferredlogbuffer .= $deferbuffer;
@@ -194,10 +203,10 @@
# Log
-sub Log ($;$) {
- my ( $msg, $deferredlog ) = @_;
-
- my @words = split( /\s+/, $msg );
+sub Log {
+ my ( @msg ) = @_;
+
+ my @words = split( /\s+/, join ( "", @msg ) );
my $col = 0;
my $sup = "";
my $word;
@@ -225,7 +234,7 @@
$deferredlogbuffer .= "\n";
- if ( !$deferredlog ) {
+ if ( ! $DEFERREDLOG ) {
FlushLog();
}
else {
@@ -243,7 +252,7 @@
}
# Warn
-sub Warn {
+sub Warn ($$) {
my ( $err, @msg ) = @_;
my $basename;
@@ -253,7 +262,7 @@
}
# Abort
-sub Abort {
+sub Abort ($$) {
my ( $err, @msg ) = @_;
my $basename;
Modified: branches/next-gen/lib/PFTools/Net.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Net.pm?rev=804&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Net.pm (original)
+++ branches/next-gen/lib/PFTools/Net.pm Fri Aug 6 08:37:40 2010
@@ -268,7 +268,7 @@
"Unable to check ".$ip_type." gateway defined from ".$netfile." into ".$net_name." definition" );
}
elsif ( ! $net_block->contains ( $ip_gw ) ) {
- Abort (
+ Abort ( $CODE->{'INVALID_VALUE'},
"Gateway ".$ip_gw." is out of range from network ".$ref_net->{'network'}
." from file ".$netfile." into ".$net_name." definition" );
}
Modified: branches/next-gen/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update.pm?rev=804&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update.pm (original)
+++ branches/next-gen/lib/PFTools/Update.pm Fri Aug 6 08:37:40 2010
@@ -542,7 +542,7 @@
my $ip = $host;
my $zone = Get_zone_from_hostname ( $host, $global_config );
if ( ! defined $zone ) {
- Warn ( "Unable to retrieve zone for hostname ".$host );
+ Warn ( $CODE->{'UNDEF_KEY'}, "Unable to retrieve zone for hostname ".$host );
return undef;
}
$ip =~ s/\.$zone$//;
@@ -550,7 +550,7 @@
my ( $hostshort, $hostvlan ) = ( $1, $3 );
my $hosttype = Get_hosttype_from_hostname ( $hostshort, $global_config );
if ( ! defined $hosttype ) {
- Warn ( "Unable to retrieve hosttype for hostname ".$host );
+ Warn ( $CODE->{'UNDEF_KEY'}, "Unable to retrieve hosttype for hostname ".$host );
return undef;
}
my $site_list = Get_site_from_hostname ( $hostshort, $global_config );
Modified: branches/next-gen/lib/PFTools/VCS.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/VCS.pm?rev=804&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/VCS.pm (original)
+++ branches/next-gen/lib/PFTools/VCS.pm Fri Aug 6 08:37:40 2010
@@ -37,7 +37,7 @@
# Updating CVS repository
sub __CVS_update ($$;$$) {
- my ( $hostname, $pf_config, $branche, $options ) = @_;
+ my ( $hostname, $pf_config, $options, $branche ) = @_;
my $cvs_cmd = $pf_config->{'vcs'}->{'command'};
if ( $branche ne '' ) {
@@ -54,20 +54,21 @@
}
my $ret;
- my $umask = umask ( $pf_config->{'vcs'}->{'umask'} );
+ my $umask = umask ( $pf_config->{'vcs'}->{'umask'} );
$ENV{'CVS_RSH'} = $pf_config->{'vcs'}->{'rsh'};
unless ( $cvs_cmd ne "" ) {
- if ( $hostname =~ /^$pf_config->{'regex'}->{'deploy_hosts'}$/ ) {
+ if ( $hostname =~ /^$pf_config->{'regex'}->{'deploy_hosts'}/ ) {
$cvs_cmd = "/usr/bin/cvs -R -d '";
}
else {
+ print $hostname." doesn't match ".$pf_config->{'regex'}->{'deploy_hosts'}."\n" if ( $options->{'verbose'} );
$cvs_cmd = "/usr/bin/cvs -d ':ext:"
.$pf_config->{'vcs'}->{'user'}.'@'
.$pf_config->{'vcs'}->{'server'}
}
- $cvs_cmd .= $pf_config->{'vcs'}->{'cvsroot'}."' checkout";
+ $cvs_cmd .= $pf_config->{'vcs'}->{'cvsroot'}."' checkout ";
$cvs_cmd .= ' -r '.$branche if ( $branche ne "" );
$cvs_cmd .= $pf_config->{'vcs'}->{'module'};
}
@@ -78,7 +79,7 @@
system ( "/bin/mkdir -p '".$co_dir. "' 2>/dev/null" );
}
- $ret = deferredlogsystem ( "cd '".$co_dir."';".$cvs_cmd, 1 );
+ $ret = deferredlogsystem ( "cd '".$co_dir."';".$cvs_cmd );
if ($ret) {
FlushLog();
}
@@ -89,11 +90,11 @@
return $ret;
}
-sub VCS_Update ($$$;$) {
+sub VCS_update ($$$;$) {
my ( $hostname, $pf_config, $options, $branche ) = @_;
- if ( $pf_config->{'vcs'} eq 'cvs' ) {
- if ( __CVS_update ( $hostname, $pf_config, $branche, $options ) ) {
+ if ( $pf_config->{'vcs'}->{'type'} eq 'cvs' ) {
+ if ( __CVS_update ( $hostname, $pf_config, $options, $branche ) ) {
return 0;
}
}
More information about the pf-tools-commits
mailing list