aboutsummaryrefslogtreecommitdiffstats
path: root/SiteSummary.pm
diff options
context:
space:
mode:
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r--SiteSummary.pm43
1 files changed, 26 insertions, 17 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm
index f710e15..fec7b09 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -12,9 +12,10 @@ our @EXPORT = qw(
get_filepath_current
get_site
get_sitegroup
+ get_hostname
get_linux_kernel_ver
- get_debian_edu_profile
- get_debian_edu_ver
+ get_debian_edu_profile
+ get_debian_edu_ver
);
my $pwd = "/var/lib/sitesummary/entries"; # Path to the entries
@@ -65,6 +66,14 @@ sub get_sitegroup {
}
#
+# Return the hostname string
+#
+sub get_hostname {
+ my $hostid = shift;
+ return get_file_string($hostid, "/system/hostname");
+}
+
+#
# Return Linux kernel version for the machines using Linux.
#
sub get_linux_kernel_ver {
@@ -77,7 +86,7 @@ sub get_linux_kernel_ver {
s/\#.+$//;
next if (/^\s*$/);
my @f = (split(/\s+/, $_));
- $kver = $f[1] if ("Linux" eq $f[0]);
+ $kver = $f[1] if ("Linux" eq $f[0]);
}
close(FILE);
return $kver;
@@ -90,16 +99,16 @@ sub get_debian_edu_profile {
my $hostid = shift;
my $path = get_filepath_current($hostid, $debian_edu_config);
if ( ! -e $path ) {
- return undef;
+ return undef;
}
if (open (FILE, $path)) {
- while (<FILE>) {
- chomp;
+ while (<FILE>) {
+ chomp;
s/\#.+$//;
- next if not (/PROFILE/);
- s/^PROFILE=//;
- return $_;
- }
+ next if not (/PROFILE/);
+ s/^PROFILE=//;
+ return $_;
+ }
}
close(FILE);
}
@@ -108,16 +117,16 @@ sub get_debian_edu_ver {
my $hostid = shift;
my $path = get_filepath_current($hostid, $debian_edu_config);
if ( ! -e $path ) {
- return undef;
+ return undef;
}
if (open (FILE, $path)) {
- while (<FILE>) {
- chomp;
+ while (<FILE>) {
+ chomp;
s/\#.+$//;
- next if not (/VERSION/);
- s/^VERSION=//;
- return $_;
- }
+ next if not (/VERSION/);
+ s/^VERSION=//;
+ return $_;
+ }
}
}