Code

Updated getFullProductHostInformation to handle non objectID elements, too
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Jan 2010 14:23:10 +0000 (14:23 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Jan 2010 14:23:10 +0000 (14:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15204 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/contrib/90_gosa.conf
gosa-si/server/events/opsi_com.pm

index 81eade305a8a7bab491194864d06a2e58fa72aa5..72ae8b088c717a075ebaadfacd0a33c0e2b14265 100644 (file)
@@ -73,7 +73,8 @@ def getFullProductHostInformation_list(self, objectId=None, installationStatus=N
         productIds= self.getProductIds_list(type, None, installationStatus)
         
         # Load product states
-        productStates= self.getProductStates_hash(objectId)
+        if objectId != None:
+            productStates= self.getProductStates_hash(objectId)
 
         # Extend every entry by name and description
         for productId in productIds:
@@ -85,10 +86,16 @@ def getFullProductHostInformation_list(self, objectId=None, installationStatus=N
 
             # Find product entry
             currentState= None
-            for state in productStates[objectId]:
-                if state['productId'] == productId:
-                    currentState= state
-                    break
+            if objectId != None:
+                for state in productStates[objectId]:
+                    if state['productId'] == productId:
+                        currentState= state
+                        break
+            else:
+                state = {}
+                state['installationStatus'] = "not_installed"
+                state['actionRequest'] = "none"
+                currentState= state
 
             # Add missing information to the productInfo
             if currentState['installationStatus'] != "not_installed" or \
index 6b9f2b761025b2ab043360734c441354bfd67632..1c67f577ebc560c2431e0fa66769340aff23278f 100644 (file)
@@ -2664,10 +2664,6 @@ sub _getProductStates_hash {
 sub _get_full_product_host_information {
        my %arg = ( 'hostId' => undef, @_ );
 
-       if (not defined $arg{hostId}) {
-               return ("function requires hostId as parameter", 1);
-       }
-
        my $res = &_callOpsi( method => 'getFullProductHostInformation_list',  params => [$arg{hostId}]);
        my ($res_error, $res_error_str) = &check_opsi_res($res);
        if ($res_error){ return ((caller(0))[3]." : ".$res_error_str, 1); }