diff options
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r-- | SiteSummary.pm | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm index fefb947..bd3107e 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -9,10 +9,11 @@ our $VERSION = 0.01; our @ISA = qw(Exporter); our @EXPORT = qw( for_all_hosts - get_filepath_current + get_filepath_current get_site + get_sitegroup get_sitecontact - get_linux_kernel_ver + get_linux_kernel_ver ); my $pwd = "/var/lib/sitesummary/entries"; # Path to the entries @@ -23,27 +24,43 @@ sub get_filepath_current { } # -# Return the site string +# Return the value string from a file, ignoring comments # -sub get_site { - my $hostid = shift; - my $path = get_filepath_current($hostid, "/siteinfo/site"); - my $site; +sub get_file_string { + my ($hostid, $filename) = @_; + my $path = get_filepath_current($hostid, $filename); + my $string; if (open (FILE, $path)) { while(<FILE>) { chomp; s/\#.+$//; next if (/^\s*$/); - $site = $_; + $string = $_; } close(FILE); - return $site; + return $string; } else { return undef; } } # +# Return the site string +# +sub get_site { + my $hostid = shift; + return get_file_string($hostid, "/siteinfo/site"); +} + +# +# Return the sitegroup string +# +sub get_sitegroup { + my $hostid = shift; + return get_file_string($hostid, "/siteinfo/sitegroup"); +} + +# # Return list with the mail addresses listed in sitecontact. # sub get_sitecontact { |