diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2011-11-26 20:54:18 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2011-11-26 20:54:18 +0000 |
commit | 46d887265b844cf29b39de210f2bd494a178cb4c (patch) | |
tree | 07ec8be5ef4184f57c08660abeac0423ce1b4f94 /site-summary | |
parent | 455bf45c129101b0427eeb2024c36c5d6275fdce (diff) | |
download | sitesummary-46d887265b844cf29b39de210f2bd494a178cb4c.tar.gz sitesummary-46d887265b844cf29b39de210f2bd494a178cb4c.tar.bz2 sitesummary-46d887265b844cf29b39de210f2bd494a178cb4c.tar.xz |
Make sure 'site-summary -l' report handle hosts without a site set.
Diffstat (limited to 'site-summary')
-rwxr-xr-x | site-summary | 9 |
1 files changed, 3 insertions, 6 deletions
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 ; } } } |