From 9f34896673a9739fb772624ef8003f7b6fecf0fb Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 4 Aug 2008 12:41:45 +0000 Subject: [PATCH] Added install event git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12138 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/client/events/opsi.pm | 41 ++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) 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 = { -- 2.30.2