summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 35fb647)
raw | patch | inline | side by side (parent: 35fb647)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Jul 2008 16:35:13 +0000 (16:35 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Jul 2008 16:35:13 +0000 (16:35 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11548 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/opsi.pm | patch | blob | history |
index 3ce4cb33a45ded8ddba50930d739faaf891ac4f4..6f8bbfdb6f7785ba95f0e14f224d1ecd2de1c166 100644 (file)
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 $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);
&add_content2xml_hash($out_hash, "session_id", $session_id);
+ &add_content2xml_hash($out_hash, "ProductId", $productId);
+
+ # Get hostID if defined
+ if (defined @{$msg_hash->{'hostId'}}[0]){
+ $hostId = @{$msg_hash->{'hostId'}}[0];
+ &add_content2xml_hash($out_hash, "hostId", $hostId);
+ }
if (defined $forward_to_gosa) {
&add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
}
-# Params += objectId ='hostId'
+ # Find properties
+ foreach my $item (@{$msg_hash->{'item'}}){
+ # JSON Query
+ my $callobj;
-# Produkt
-# Property
-# Wert
-# <ProductId>ntfs-restore-image</ProductId>
-# <item>
-# <name>askbeforeinst</name>
-# <value>false</value>
-# </item>
+ if (defined $hostId){
+ $callobj = {
+ method => 'setProductProperty',
+ params => [ $productId, $item->{'name'}[0], $item->{'value'}[0], $hostId ],
+ id => 1,
+ };
+ } else {
+ $callobj = {
+ method => 'setProductProperty',
+ params => [ $productId, $item->{'name'}[0], $item->{'value'}[0] ],
+ id => 1,
+ };
+ }
+
+ my $res = $client->call($opsi_url, $callobj);
+
+ if (!check_res($res)){
+ &main::daemon_log("ERROR: no communication failed while setting '".$item->{'name'}[0]."': ".$res->error_message, 1);
+ &add_content2xml_hash($out_hash, "error", $$res->error_message);
+ }
+
+ }
# return message
return &create_xml_string($out_hash);