diff options
-rw-r--r-- | SiteSummary.pm | 6 | ||||
-rwxr-xr-x | sitesummary-nodes | 12 |
2 files changed, 8 insertions, 10 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm index 50d4fbc..630c003 100644 --- a/SiteSummary.pm +++ b/SiteSummary.pm @@ -14,6 +14,7 @@ our @EXPORT = qw( get_site get_sitegroup get_hostname + get_dns_address get_linux_kernel_ver get_debian_edu_profile get_debian_edu_ver @@ -110,6 +111,11 @@ sub get_hostname { # but fall back to the IP address if the IP address do not resolve in # DNS. # +sub in_dns { + my $hostname = shift; + my $packed_ip = gethostbyname($hostname); + return defined $packed_ip; +} sub get_dns_address { my $hostid = shift; my $hostname = get_hostname($hostid); diff --git a/sitesummary-nodes b/sitesummary-nodes index e08efcd..1a08470 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -24,12 +24,6 @@ if ($opts{'m'}) { print_list(); } -sub in_dns { - my $hostname = shift; - my $packed_ip = gethostbyname($hostname); - return defined $packed_ip; -} - sub handle_host { my $hostid = shift; my $address = get_dns_address($hostid); @@ -182,8 +176,7 @@ define service { check_command check_ssh } EOF - print <<EOF if (is_pkg_installed($hostid, "apache") || - is_pkg_installed($hostid, "apache2")); + print <<EOF if (is_pkg_installed($hostid, "apache") || is_pkg_installed($hostid, "apache2")); define service { use server-service host_name $hostname @@ -192,8 +185,7 @@ define service { } EOF - print <<EOF if (is_pkg_installed($hostid, "ntp") || - is_pkg_installed($hostid, "ntp-server")); + print <<EOF if (is_pkg_installed($hostid, "ntp") || is_pkg_installed($hostid, "ntp-server")); define service { use server-service host_name $hostname |