From efb237aaeb9a2c3c0e46563f8bf9eac947e0ae11 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 2 Jul 2008 20:48:20 +0000 Subject: [PATCH] Updated opsi module git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11516 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/client/events/opsi.pm | 68 +++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/gosa-si/client/events/opsi.pm b/gosa-si/client/events/opsi.pm index 9d3f0dfff..04473295c 100644 --- a/gosa-si/client/events/opsi.pm +++ b/gosa-si/client/events/opsi.pm @@ -91,6 +91,12 @@ sub opsi_get_netboot_products { my $target = @{$msg_hash->{'target'}}[0]; my $session_id = @{$msg_hash->{'session_id'}}[0]; my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; + my $hostId; + + # Get hostID if defined + if (defined @{$msg_hash->{'hostId'}}[0]){ + $hostId = @{$msg_hash->{'hostId'}}[0]; + } # build return message with twisted target and source my $out_hash = &main::create_xml_hash("answer_$header", $target, $source); @@ -103,11 +109,20 @@ sub opsi_get_netboot_products { my $xml_msg= &create_xml_string($out_hash); # Authenticate - my $callobj = { - method => 'getNetBootProductIds_list', - params => [ ], - id => 1, - }; + my $callobj; + if (defined $hostId){ + $callobj = { + method => 'getNetBootProductIds_list', + params => [ $hostId ], + id => 1, + }; + } else { + $callobj = { + method => 'getNetBootProductIds_list', + params => [ ], + id => 1, + }; + } my $res = $client->call($opsi_url, $callobj); if (check_res($res)){ @@ -146,6 +161,12 @@ sub opsi_get_product_properties { my $session_id = @{$msg_hash->{'session_id'}}[0]; my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; my $productId = @{$msg_hash->{'ProductId'}}[0]; + my $hostId; + + # Get hostID if defined + if (defined @{$msg_hash->{'hostId'}}[0]){ + $hostId = @{$msg_hash->{'hostId'}}[0]; + } # build return message with twisted target and source my $out_hash = &main::create_xml_hash("answer_$header", $target, $source); @@ -158,6 +179,9 @@ sub opsi_get_product_properties { &add_content2xml_hash($out_hash, "xxx", ""); my $xml_msg= &create_xml_string($out_hash); + +# Move to getProductProperties_hash prod + objectid + # JSON Query my $callobj = { method => 'getProductPropertyDefinitions_listOfHashes', @@ -198,6 +222,12 @@ sub opsi_set_product_properties { my $target = @{$msg_hash->{'target'}}[0]; my $session_id = @{$msg_hash->{'session_id'}}[0]; my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; + my $hostId; + + # Get hostID if defined + if (defined @{$msg_hash->{'hostId'}}[0]){ + $hostId = @{$msg_hash->{'hostId'}}[0]; + } # build return message with twisted target and source my $out_hash = &main::create_xml_hash("answer_$header", $target, $source); @@ -207,6 +237,8 @@ sub opsi_set_product_properties { &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa); } +# Params += objectId ='hostId' + # Produkt # Property # Wert @@ -320,6 +352,12 @@ sub opsi_get_local_products { my $target = @{$msg_hash->{'target'}}[0]; my $session_id = @{$msg_hash->{'session_id'}}[0]; my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0]; + my $hostId; + + # Get hostID if defined + if (defined @{$msg_hash->{'hostId'}}[0]){ + $hostId = @{$msg_hash->{'hostId'}}[0]; + } # build return message with twisted target and source my $out_hash = &main::create_xml_hash("answer_$header", $target, $source); @@ -331,11 +369,21 @@ sub opsi_get_local_products { &add_content2xml_hash($out_hash, "xxx", ""); my $xml_msg= &create_xml_string($out_hash); - my $callobj = { - method => 'getLocalBootProductIds_list', - params => [ ], - id => 1, - }; + # Append hostId + my $callobj; + if (defined $hostId){ + $callobj = { + method => 'getLocalBootProductIds_list', + params => [ $hostId ], + id => 1, + }; + } else { + $callobj = { + method => 'getLocalBootProductIds_list', + params => [ ], + id => 1, + }; + } my $res = $client->call($opsi_url, $callobj); if (check_res($res)){ -- 2.30.2