From 6696d2352b157a869bcbe96a364aaf6b65cf9770 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Wed, 21 May 2008 20:28:57 -0700 Subject: Fix 3273: "show vrrp summary" output doesn't line-up when using vlans --- scripts/keepalived/vyatta-show-vrrp.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/keepalived/vyatta-show-vrrp.pl b/scripts/keepalived/vyatta-show-vrrp.pl index 78e58970..4910e092 100755 --- a/scripts/keepalived/vyatta-show-vrrp.pl +++ b/scripts/keepalived/vyatta-show-vrrp.pl @@ -176,9 +176,10 @@ sub vrrp_showsummary { if ($state eq "master" || $state eq "backup" || $state eq "fault") { my ($primary_addr, $priority, $preempt, $advert_int, $auth_type, @vips) = VyattaKeepalived::vrrp_get_config($intf, $group); - print "\n$intf\t\t$group\tint\t$primary_addr\t$link\t\t$state"; + my $format = "\n%-16s%-8s%-8s%-16s%-16s%-16s"; + printf($format, $intf, $group, 'int', $primary_addr, $link, $state); foreach my $vip (@vips){ - print "\n\t\t\tvip\t$vip"; + printf("\n%-24s%-8s%-16s", ' ', 'vip', $vip); } } else { print "Physical interface $intf, State: unknown\n"; @@ -262,9 +263,11 @@ if (!VyattaKeepalived::is_running()) { my $display_func; if ($showsummary == 1) { $display_func = \&vrrp_showsummary; - print "\t\tVRRP\tAddr\t\t\tInterface\tVRRP\n"; - print "Interface\tGroup\tType\tAddress\t\tState\t\tState\n"; - print "---------\t-----\t----\t-------\t\t-----\t\t-----"; + my $format = '%-16s%-8s%-8s%-16s%-16s%-16s%s'; + printf($format, '', 'VRRP', 'Addr', '', 'Interface', 'VRRP', "\n"); + printf($format, 'Interface', 'Group', 'Type', 'Address', 'State', 'State', + "\n"); + printf($format, '-' x 9, '-' x 5, '-' x 4 , '-' x 7, '-' x 5, '-' x 5, ''); } else { $display_func = \&vrrp_show; } -- cgit v1.2.3