Code

update: opsi_install_client events are displayed in job_queue as trigger_action_install
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Aug 2008 16:22:42 +0000 (16:22 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Aug 2008 16:22:42 +0000 (16:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12159 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 1aeaeffdda0a3dfedeb975de47872cab45c695cb..a2eaf89a15f2a5b79d5739ad2c298682c5427586 100755 (executable)
@@ -1503,12 +1503,13 @@ sub watch_for_done_jobs {
 sub watch_for_opsi_jobs {
     my ($kernel) = $_[KERNEL];
 
-    my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE ((headertag='opsi_install_client') AND (status='processing'))";
+    # This is not very nice to look for opsi install jobs, but headertag has to be trigger_action_reinstall. The only way to identify a 
+    # opsi install job is to parse the xml message. There is still the correct header.
+    my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE ((xmlmessage LIKE '%opsi_install_client</header>%') AND (status='processing'))";
        my $res = $job_db->select_dbentry( $sql_statement );
 
     # Ask OPSI for an update of the running jobs
     while (my ($id, $hit) = each %$res ) {
-
         # Determine current parameters of the job
         my $hostId = $hit->{'plainname'};
         my $macaddress = $hit->{'macaddress'};
index 787b7ce00c51bed47a66b6562855a53b7962afbe..21a53cdb390c7dcea66e55a7c6bb392b6d469f7a 100644 (file)
@@ -247,6 +247,7 @@ sub process_job_msg {
             &daemon_log("$session_id ERROR: opsi_install_client-message has no xml-tag 'hostID', job was not created: $msg", 1);
         } else {
             $plain_name = $msg_hash->{'hostId'}[0];
+            $header = "trigger_action_reinstall"
         }
 
     } else {   # Try to determine plain_name via ladp search
index 604172c20ddba127bb71a3e694b2f9c617511bf2..c5d604e317363662690d22d9a7eaf25e71c43859 100644 (file)
@@ -638,54 +638,54 @@ sub opsi_install_client {
         push(@out_msg_l, $out_msg);
     } 
 
-    # Set parameters in opsi
-    if (not $error) {
-        # build return message with twisted target and source
-        my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
-
-        if (defined $forward_to_gosa) {
-            &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
-        }
-        &add_content2xml_hash($out_hash, "hostId", "$hostId");
-
-        # Load all products for this host with status != "not_installed" or actionRequest != "none"
-        if (defined $hostId){
-            my $callobj = {
-                method  => 'getProductStates_hash',
-                params  => [ $hostId ],
-                id  => 1,
-            };
-
-            my $hres = $main::opsi_client->call($main::opsi_url, $callobj);
-            if (&main::check_opsi_res($hres)){
-                my $htmp= $hres->result->{$hostId};
-
-                # check state != not_installed or action == setup -> load and add
-                foreach my $product (@{$htmp}){
-                    # Now we've a couple of hashes...
-                    if ($product->{'installationStatus'} ne "not_installed" or
-                            $product->{'actionRequest'} ne "none"){
-
-                        # Do an action request for all these -> "setup".
-                        $callobj = {
-                            method  => 'setProductActionRequest',
-                            params  => [ $product->{'productId'}, $hostId, "setup" ],
-                            id  => 1,
-                        };
-                        my $res = $main::opsi_client->call($main::opsi_url, $callobj);
-                        if (!&main::check_opsi_res($res)){
-                            &main::daemon_log("ERROR: cannot set product action request for $hostId!", 1);
-                        } else {
-                            &main::daemon_log("INFO: requesting 'setup' for '".$product->{'productId'}."' on $hostId", 1);
-                        }
-
-                    }
-                }
-            }
-        }
-
-        push(@out_msg_l, &create_xml_string($out_hash));
-    }
+#    # Set parameters in opsi
+#    if (not $error) {
+#        # build return message with twisted target and source
+#        my $out_hash = &main::create_xml_hash("answer_$header", $target, $source);
+#
+#        if (defined $forward_to_gosa) {
+#            &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
+#        }
+#        &add_content2xml_hash($out_hash, "hostId", "$hostId");
+#
+#        # Load all products for this host with status != "not_installed" or actionRequest != "none"
+#        if (defined $hostId){
+#            my $callobj = {
+#                method  => 'getProductStates_hash',
+#                params  => [ $hostId ],
+#                id  => 1,
+#            };
+#
+#            my $hres = $main::opsi_client->call($main::opsi_url, $callobj);
+#            if (&main::check_opsi_res($hres)){
+#                my $htmp= $hres->result->{$hostId};
+#
+#                # check state != not_installed or action == setup -> load and add
+#                foreach my $product (@{$htmp}){
+#                    # Now we've a couple of hashes...
+#                    if ($product->{'installationStatus'} ne "not_installed" or
+#                            $product->{'actionRequest'} ne "none"){
+#
+#                        # Do an action request for all these -> "setup".
+#                        $callobj = {
+#                            method  => 'setProductActionRequest',
+#                            params  => [ $product->{'productId'}, $hostId, "setup" ],
+#                            id  => 1,
+#                        };
+#                        my $res = $main::opsi_client->call($main::opsi_url, $callobj);
+#                        if (!&main::check_opsi_res($res)){
+#                            &main::daemon_log("ERROR: cannot set product action request for $hostId!", 1);
+#                        } else {
+#                            &main::daemon_log("INFO: requesting 'setup' for '".$product->{'productId'}."' on $hostId", 1);
+#                        }
+#
+#                    }
+#                }
+#            }
+#        }
+#
+#        push(@out_msg_l, &create_xml_string($out_hash));
+#    }
 
     # Build wakeup message for client
     if (not $error) {