Code

bugfix: gosa-si can handle empty get_hardware opsi answers
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Aug 2008 08:50:38 +0000 (08:50 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Aug 2008 08:50:38 +0000 (08:50 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12271 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/server/events/opsi_com.pm

index 105c9b450c2b2885e6cef37c8ab7f09d66f80731..55d851a0b46c72bd92ab666f7c4eb97aee25a667 100644 (file)
@@ -767,21 +767,24 @@ sub opsi_get_client_hardware {
         my $res = $main::opsi_client->call($main::opsi_url, $callobj);
         if (not &check_opsi_res($res)){
             my $result= $res->result;
-            foreach my $r (keys %{$result}){
-                my $item= "\n<item><id>".xml_quote($r)."</id>";
-                my $value= $result->{$r};
-                foreach my $sres (@{$value}){
-
-                    foreach my $dres (keys %{$sres}){
-                        if (defined $sres->{$dres}){
-                            $item.= "<$dres>".xml_quote($sres->{$dres})."</$dres>";
+print STDERR Dumper($result);   
+            if (ref $result eq "HASH") {
+                foreach my $r (keys %{$result}){
+                    my $item= "\n<item><id>".xml_quote($r)."</id>";
+                    my $value= $result->{$r};
+                    foreach my $sres (@{$value}){
+
+                        foreach my $dres (keys %{$sres}){
+                            if (defined $sres->{$dres}){
+                                $item.= "<$dres>".xml_quote($sres->{$dres})."</$dres>";
+                            }
                         }
+
                     }
+                    $item.= "</item>";
+                    $xml_msg=~ s%<xxx></xxx>%$item<xxx></xxx>%;
 
                 }
-                $item.= "</item>";
-                $xml_msg=~ s%<xxx></xxx>%$item<xxx></xxx>%;
-
             }
         }