Code

bugfix: opsi_set_product_properties without xml tag hostid act for all opsi clients
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 20 Oct 2008 09:07:36 +0000 (09:07 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 20 Oct 2008 09:07:36 +0000 (09:07 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12737 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/server/events/opsi_com.pm

index 83d2f2637d94fe4516e41615163608076be55ac4..e4cc7185d2acf13542037bef68bc74183abc1a7c 100755 (executable)
@@ -2193,16 +2193,12 @@ sub change_fai_state {
                                  my %tmp = map { $_ => 1 } $entry->get_value("objectClass");
                                  if (exists $tmp{'FAIobject'}){
                                          if ($state eq ''){
-                                                 $result= $ldap_handle->modify($entry->dn, changes => [
-                                                         delete => [ FAIstate => [] ] ]);
+                                                 $result= $ldap_handle->modify($entry->dn, changes => [ delete => [ FAIstate => [] ] ]);
                                          } else {
-                                                 $result= $ldap_handle->modify($entry->dn, changes => [
-                                                         replace => [ FAIstate => $state ] ]);
+                                                 $result= $ldap_handle->modify($entry->dn, changes => [ replace => [ FAIstate => $state ] ]);
                                          }
                                  } elsif ($state ne ''){
-                                         $result= $ldap_handle->modify($entry->dn, changes => [
-                                                 add     => [ objectClass => 'FAIobject' ],
-                                                 add     => [ FAIstate => $state ] ]);
+                                         $result= $ldap_handle->modify($entry->dn, changes => [ add => [ objectClass => 'FAIobject' ], add => [ FAIstate => $state ] ]);
                                  }
 
                                  # Errors?
@@ -2265,8 +2261,7 @@ sub change_goto_state {
 
             daemon_log("$session_id INFO: Setting gotoMode to '$state' for ".$entry->dn, 5);
             my $result;
-            $result= $ldap_handle->modify($entry->dn, changes => [
-                                                replace => [ gotoMode => $state ] ]);
+            $result= $ldap_handle->modify($entry->dn, changes => [replace => [ gotoMode => $state ] ]);
 
             # Errors?
             if ($result->code){
index fd6ba5da5a54d5da0e18b5a07ad0def43f562854..851a65e02f0e38e2a6fec921bdaa6d77c8e4aa1f 100644 (file)
@@ -685,7 +685,8 @@ sub opsi_set_product_properties {
             return ( &create_xml_string($out_hash) );
         }
     }
-    if ((exists $msg_hash->{'hostId'}) && (@{$msg_hash->{'hostId'}} != 1) || (@{$msg_hash->{'hostId'}}[0] eq ref 'HASH'))  {
+    # if no hostId is given, set_product_properties will act on globally
+    if ((exists $msg_hash->{'hostId'}) && (@{$msg_hash->{'hostId'}} > 1))  {
         &add_content2xml_hash($out_hash, "error_string", "hostId contains no or more than one values");
         &add_content2xml_hash($out_hash, "error", "hostId");
         &main::daemon_log("$session_id ERROR: hostId contains no or more than one values: $msg", 1);