From: cajus Date: Mon, 4 Aug 2008 12:41:45 +0000 (+0000) Subject: Added install event X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9f34896673a9739fb772624ef8003f7b6fecf0fb;p=gosa.git Added install event git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12138 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/opsi.pm b/gosa-si/client/events/opsi.pm index 128260358..82bf4f88d 100644 --- a/gosa-si/client/events/opsi.pm +++ b/gosa-si/client/events/opsi.pm @@ -727,9 +727,44 @@ sub opsi_install_client { } &add_content2xml_hash($out_hash, "hostId", "$hostId"); -# Setze alles was auf "installed" steht auf setup -# Schaue nach produkten für diesen Host -# Setze alle Produkte dieses Hosts auf "setup" + # 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 = $client->call($opsi_url, $callobj); + if (check_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 = $client->call($opsi_url, $callobj); + if (!check_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); + } + + } + } + } + } + + # # JSON Query # my $callobj = {