Code

Apply fix for #2852
[gosa.git] / trunk / gosa-si / gosa-si-client
index 4d109684f37373877307f7613457f0acda37d2ac..45a3b29389495b436906048905a35af8769e0b53 100755 (executable)
@@ -163,7 +163,6 @@ sub check_cmdline_param () {
     }
 }
 
-
 #===  FUNCTION  ================================================================
 #         NAME: check_pid
 #   PARAMETERS:
@@ -317,7 +316,6 @@ sub get_mac {
 }
 
 
-
 #===  FUNCTION  ================================================================
 #         NAME:  get_local_mac_for_remote_ip
 #   PARAMETERS:  none (takes server_ip from global variable)
@@ -331,7 +329,7 @@ sub get_local_mac_for_remote_ip {
 
        if($server_ip =~ /^[a-z][a-z0-9\.]$/i) {
                my $ip_address = inet_ntoa(scalar gethostbyname($server_ip));
-               if(defined($ip_address) && $ip_address =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ && $port =~ /^\d+$/) {
+               if(defined($ip_address) && $ip_address =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) {
                        # Write ip address to $server_ip variable
                        $server_ip = $ip_address;
                }
@@ -803,7 +801,7 @@ sub trigger_seen_messages {
     # Select all files under /tmp with prefix 'goto_notify'
     my $goto_dir = "/tmp";
     opendir(DIR, $goto_dir);
-    my @goto_files = grep { /^goto_notify_/ && -f "$goto_dir/$_" } readdir(DIR);
+    my @goto_files = grep { /.goto_notify$/ && -f "$goto_dir/$_" } readdir(DIR);
     closedir DIR;
 
     # Check if file has 'seen' tag
@@ -898,7 +896,7 @@ sub fifo_got_record {
     &send_msg_to_target($clmsg, $server_address, $server_key, "CLMSG_$header");
 
     # if installation finished, save all log files 
-    if ($file_record eq "TASKBEGIN finish") {
+    if ($file_record eq "TASKBEGIN savelog") {
         &save_fai_log($fai_log_dir); 
     }
 
@@ -909,6 +907,7 @@ sub fifo_got_record {
 sub save_fai_log {
     my ($fai_log_dir) = @_ ;
     my $FAI_DIR;
+    my $fai_action;
 
        # Directory for log files after a softupdate
     my $log_dir = File::Spec->catdir($fai_log_dir, "localhost/last");
@@ -920,6 +919,11 @@ sub save_fai_log {
                                daemon_log("ERROR: cannot open directory $log_dir", 1);
                                return; 
                }
+        $fai_action = "install";
+    }
+    else {
+        # If we already have a logdir, we can assume that this is a softupdate
+        $fai_action = "softupdate";
     }
 
     opendir($FAI_DIR, "$log_dir");
@@ -949,6 +953,7 @@ sub save_fai_log {
     my $all_log_string = join("\n", @log_list); 
     my $msg_hash = &create_xml_hash("CLMSG_save_fai_log", $client_address, $server_address, $all_log_string);
     &add_content2xml_hash($msg_hash, "macaddress", $client_mac_address);
+    &add_content2xml_hash($msg_hash, "fai_action", $fai_action);
     my $msg = &create_xml_string($msg_hash);
     &send_msg_to_target($msg, $server_address, $server_key, "CLMSG_save_fai_log");