From 20c2b86efc797b27151719c4bc6f7f11738dd739 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Wed, 15 Feb 2012 09:11:37 -0800 Subject: Cleanup 'show firewall summary' --- scripts/firewall/vyatta-show-firewall-summary.pl | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/firewall/vyatta-show-firewall-summary.pl b/scripts/firewall/vyatta-show-firewall-summary.pl index fc0b5c9..dfcf776 100755 --- a/scripts/firewall/vyatta-show-firewall-summary.pl +++ b/scripts/firewall/vyatta-show-firewall-summary.pl @@ -1,7 +1,6 @@ #!/usr/bin/env perl use lib '/opt/vyatta/share/perl5/'; use Vyatta::FirewallOpMode::Summary; -use Data::Dumper; my %description_hash = ( 'name' => 'IPv4', 'ipv6-name' => 'IPv6', @@ -19,21 +18,20 @@ sub print_global_fw_header { } sub print_fw_ruleset_header { - print "\n" . "-" x 29 . "\n"; + print "\n" . "-" x 24 . "\n"; print "Firewall Rulesets\n"; - print "-" x 29 . "\n"; + print "-" x 24 . "\n"; } sub print_fw_group_header { - print "\n" . "-" x 29 . "\n"; + print "\n" . "-" x 24 . "\n"; print "Firewall Groups\n"; - print "-" x 29 . "\n"; + print "-" x 24 . "\n"; } - my $hash = Vyatta::FirewallOpMode::Summary::get_firewall_summary(); -if (defined $hash->{'global'}){ - print_global_fw_header; +print_global_fw_header; +if (scalar(keys(%{$hash->{'global'}})) > 0){ my $state_format = " %-15s %-8s %-8s\n"; print "\nFirewall state-policy for all IPv4 and Ipv6 traffic\n\n"; printf($state_format, 'state', 'action', 'log'); @@ -48,6 +46,7 @@ print_fw_ruleset_header; my $format = " %-26s%-15s%-s\n"; for my $tree (keys(%{$hash})){ next if ($tree eq 'global'); + next if (scalar(keys(%{$hash->{$tree}})) == 0); print "\n$description_hash{$tree} name:\n\n"; printf $format, 'Rule-set name', 'Description', 'References'; printf $format, '-------------', '-----------', '----------'; @@ -161,4 +160,3 @@ foreach my $type (keys(%{$gr_hash})){ } print "\n"; } -#print Dumper $gr_hash; -- cgit v1.2.3