[Pkg-voip-commits] [dahdi-tools] 188/285: dahdi_genconf: remove hard-coded E1 default

tzafrir at debian.org tzafrir at debian.org
Thu Jul 7 19:18:54 UTC 2016


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository dahdi-tools.

commit 1e6b2741db99b34f7d63ac96dd5a876686d27131
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Sun Apr 6 13:01:32 2014 -0400

    dahdi_genconf: remove hard-coded E1 default
    
    * The "spantypes" generator had E1 default if no 'line-mode' parameter
      was passed.
    
    * As a result the new logic in "dahdi_span_types dumpconfig" had no
      effect when called from dahdi_genconf, as it was always called
      with "--line-mode=" argument.
    
    * Now "dahdi_genconf spantype" behaves just like
      "dahdi_span_types dumpconfig":
      - The "--line-mode=" forces generation of provided line-mode (E1/J1/T1)
      - Without this option, the generated config matches the current spans
        state according to new dahd_span_types default logic:
        - Wildcard rule if all spans have same line-mode.
        - Uncommented specific matches if spans have different line-modes.
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
    Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>
---
 xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm b/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
index dfa0608..b1914bb 100644
--- a/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
+++ b/xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm
@@ -30,16 +30,21 @@ sub generate($$$) {
 	return if $?;
 
 	my $line_mode = $genopts->{'line-mode'};
-	$line_mode = 'E1' unless defined $line_mode;
-	$line_mode =~ /^[ETJ]1$/ or die "Bad line-mode='$line_mode'\n";
-	warn "Empty configuration -- no spans\n" unless @spans;
+	my $cmd;
+	if (defined $line_mode) {
+		$line_mode =~ /^[ETJ]1$/ or die "Bad line-mode='$line_mode'\n";
+		$cmd = "dahdi_span_types --line-mode=$line_mode dumpconfig > $file";
+		printf("Generating $file (with default line-mode %s)\n", $line_mode)
+			if $genopts->{verbose};
+	} else {
+		$cmd = "dahdi_span_types dumpconfig > $file";
+		printf("Generating $file (no --line-mode override)\n")
+			if $genopts->{verbose};
+	}
 	rename "$file", "$file.bak"
 		or $! == 2	# ENOENT (No dependency on Errno.pm)
 		or die "Failed to backup old config: $!\n";
 	#$gconfig->dump;
-	printf("Generating $file (with default line-mode %s)\n", $line_mode)
-		if $genopts->{verbose};
-	my $cmd = "dahdi_span_types --line-mode=$line_mode dumpconfig > $file";
 	system $cmd;
 	die "Command failed (status=$?): '$cmd'" if $?;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git



More information about the Pkg-voip-commits mailing list