Code

Fixed repository service
[gosa.git] / gosa-si / server / events / siTriggered.pm
index 9050d554bc75fec9d00512a64dd3db4805c9f98b..18a2a5eb0f935abb536cd1a9ba83e18aab747745 100644 (file)
@@ -47,7 +47,7 @@ sub read_configfile {
     my ($cfg_file, %cfg_defaults) = @_;
     my $cfg;
 
-    if( defined( $cfg_file) && ( length($cfg_file) > 0 )) {
+    if( defined( $cfg_file) && ( (-s $cfg_file) > 0 )) {
         if( -r $cfg_file ) {
             $cfg = Config::IniFiles->new( -file => $cfg_file );
         } else {
@@ -143,7 +143,7 @@ sub detected_hardware {
        # Build LDAP connection
     my $ldap_handle = &main::get_ldap_handle($session_id);
        if( not defined $ldap_handle ) {
-               &main::daemon_log("$session_id ERROR: cannot connect to ldap: $ldap_uri", 1)
+               &main::daemon_log("$session_id ERROR: cannot connect to ldap: $ldap_uri", 1);
                return;
        } 
 
@@ -208,7 +208,7 @@ sub detected_hardware {
                        if(defined($msg_hash->{detected_hardware}[0]->{$attribute}) &&
                                length($msg_hash->{detected_hardware}[0]->{$attribute}) >0 ) {
                                if(defined($entry->get_value($attribute))) {
-                                       $entry->delete($attribute);
+                                       $entry->delete($attribute => []);
                                }
                                &main::daemon_log("INFO: Adding attribute $attribute with value ".$msg_hash->{detected_hardware}[0]->{$attribute},5);
                                $entry->add($attribute => $msg_hash->{detected_hardware}[0]->{$attribute});     
@@ -219,9 +219,9 @@ sub detected_hardware {
                        if(defined($msg_hash->{detected_hardware}[0]->{$attribute}) &&
                                length($msg_hash->{detected_hardware}[0]->{$attribute}) >0 ) {
                                if(defined($entry->get_value($attribute))) {
-                                       $entry->delete($attribute);
+                                       $entry->delete($attribute => []);
                                }
-                               foreach my $array_entry (@{$msg_hash->{detected_hardware}[0]->{$attribute}}) {
+                               foreach my $array_entry (keys %{{map { $_ => 1 } sort(@{$msg_hash->{detected_hardware}[0]->{$attribute}}) }}) {
                                        $entry->add($attribute => $array_entry);
                                }
                        }