diff options
author | John Southworth <john.southworth@vyatta.com> | 2012-02-15 09:11:37 -0800 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2012-02-15 09:11:37 -0800 |
commit | 20c2b86efc797b27151719c4bc6f7f11738dd739 (patch) | |
tree | 1b71b95bd46c376b471b87e0443b85608b7270ae | |
parent | 4e49428c2fc2b8174d04bce57d7d1cad2255cb57 (diff) | |
download | vyatta-op-firewall-20c2b86efc797b27151719c4bc6f7f11738dd739.tar.gz vyatta-op-firewall-20c2b86efc797b27151719c4bc6f7f11738dd739.zip |
Cleanup 'show firewall summary'
-rwxr-xr-x | scripts/firewall/vyatta-show-firewall-summary.pl | 16 |
1 files changed, 7 insertions, 9 deletions
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; |