From 46d887265b844cf29b39de210f2bd494a178cb4c Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sat, 26 Nov 2011 20:54:18 +0000 Subject: Make sure 'site-summary -l' report handle hosts without a site set. --- site-summary | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'site-summary') diff --git a/site-summary b/site-summary index 61b5dc9..9d77c53 100755 --- a/site-summary +++ b/site-summary @@ -31,8 +31,9 @@ sub handle_host { my $hostid = shift; #print "$hostid\n"; for my $site (get_site($hostid)) { - $site = "" unless defined $site; + $site = "SiteMissing" unless defined $site; $sites{$site}++; + $hostmap{$site} = [] unless exists $hostmap{$site}; my $sitegroup = get_sitegroup($hostid); if ($sitegroup) { $sitegroups{$site}{$sitegroup}++; @@ -42,11 +43,7 @@ sub handle_host { $sitegroupmap{$site}{$sitegroup} = [$hostid]; } } else { - if (exists $hostmap{$site}) { - push @{$hostmap{$site}}, $hostid ; - } else { - $hostmap{$site} = [$hostid]; - } + push @{$hostmap{$site}}, $hostid ; } } } -- cgit v1.2.3