Code

bugfixing problems in finding gosa-si-servers from dns
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Aug 2008 09:14:25 +0000 (09:14 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 29 Aug 2008 09:14:25 +0000 (09:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12310 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-client
gosa-si/modules/GosaSupportDaemon.pm
gosa-si/tests/client.php

index 767446c7754eb493e07aac9d5c557ab518c6af4c..5a1bc3fe1aa95016ac758f762241edeac2be1211 100755 (executable)
@@ -1144,16 +1144,24 @@ if( defined $server_check ) {
        my @tmp_servers;
        if ( !$server_domain) {
                # Try our DNS Searchlist
-               for my $domain(get_dns_domains()) {
+        my @domain_list = &get_dns_domains();
+        my $tmp_domains;
+        my $error_string;
+               for my $domain (@domain_list) {
                        chomp($domain);
-                       my @tmp_domains= &get_server_addresses($domain);
-                       if(@tmp_domains) {
-                               for my $tmp_server(@tmp_domains) {
+            ($tmp_domains, $error_string) = &get_server_addresses($domain);
+                       if(@$tmp_domains) {
+                               for my $tmp_server(@$tmp_domains) {
                                        push @tmp_servers, $tmp_server;
                                }
                        }
                }
                if (0 == @tmp_servers) {
+            my $log_string = "no gosa-si-server found!";
+            $log_string .= "\n\tdetermined domains out of /etc/resolf.conf: ".join(", ", @domain_list); 
+            $log_string .= "\n\tdetermined server addresses in domains: ".join(", ",@$tmp_domains); 
+            daemon_log("ERROR: $log_string", 1);
+            daemon_log("ERROR: $error_string", 1);
                        daemon_log("ERROR: please specify a gosa-si-server address or a domain in config file", 1);
                        kill 2, $$;
                }
index c10a0e46f5d19f03f12017b6974ea30b1f9104eb..9d07d0a0cea6bcfba2b805d5ef8f806dfd04c116 100644 (file)
@@ -435,6 +435,7 @@ sub get_dns_domains() {
 sub get_server_addresses {
     my $domain= shift;
     my @result;
+    my $error_string;
 
     my $error = 0;
     my $res   = Net::DNS::Resolver->new;
@@ -447,7 +448,7 @@ sub get_server_addresses {
         }
     }
     else {
-        #warn "query failed: ", $res->errorstring, "\n";
+        $error_string = "determination of '_gosa-si._tcp' server in domain '$domain' failed: ".$res->errorstring;
         $error++;
     }
 
@@ -466,7 +467,7 @@ sub get_server_addresses {
         }
     }
 
-    return @result;
+    return \@result, $error_string;
 }
 
 
index 759bbacb55cde3fb0779bf3a72ce015393a63092..2068b35f01ad675dd689c0f990bef9f40e561352 100755 (executable)
@@ -136,7 +136,7 @@ for($count = 1; $count <= $zahl; $count++)
     #$data = "<xml> <header>gosa_opsi_get_product_properties</header> <source>GOSA</source> <target>GOSA</target> <productId>firefox</productId> <hostId>linux-cl-2.intranet.gonicus.de</hostId> </xml>";
 
     # Set product properties - global
-    $data = "<xml> <header>gosa_opsi_set_product_properties</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <productId>javavm</productId> <item><name>askbeforeinst</name><value>false</value></item></xml>";
+    #$data = "<xml> <header>gosa_opsi_set_product_properties</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <productId>javavm</productId> <item><name>askbeforeinst</name><value>false</value></item></xml>";
 
     # Set product properties - per host
     #$data = "<xml> <header>gosa_opsi_set_product_properties</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <hostId>linux-cl-2.intranet.gonicus.de</hostId> <productId>firefox</productId> <item> <name>askbeforeinst</name> <value>false</value> </item> </xml>";
@@ -149,7 +149,7 @@ for($count = 1; $count <= $zahl; $count++)
     #$data = "<xml> <header>gosa_opsi_get_client_software</header> <source>GOSA</source> <target>GOSA</target> <hostId>linux-cl-2.intranet.gonicus.de</hostId> </xml>";
 
     # List Opsi clients
-    #$data = "<xml> <header>gosa_opsi_list_clients</header> <source>GOSA</source> <target>GOSA</target> </xml>";
+    $data = "<xml> <header>gosa_opsi_list_clients</header> <source>GOSA</source> <target>GOSA</target> </xml>";
 
     # Delete Opsi client
     #$data = "<xml> <header>gosa_opsi_del_client</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <hostId>linux-cl-2.intranet.gonicus.de</hostId></xml>";