From: rettenbe Date: Tue, 5 Aug 2008 16:22:42 +0000 (+0000) Subject: update: opsi_install_client events are displayed in job_queue as trigger_action_install X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1766ce40e15b64c9255ec4a6ef19c1ec650e797f;p=gosa.git update: opsi_install_client events are displayed in job_queue as trigger_action_install git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12159 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 1aeaeffdd..a2eaf89a1 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -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%') 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'}; diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 787b7ce00..21a53cdb3 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -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 diff --git a/gosa-si/server/events/opsi_com.pm b/gosa-si/server/events/opsi_com.pm index 604172c20..c5d604e31 100644 --- a/gosa-si/server/events/opsi_com.pm +++ b/gosa-si/server/events/opsi_com.pm @@ -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) {