summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b24e3b1)
raw | patch | inline | side by side (parent: b24e3b1)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 26 Jun 2008 09:51:55 +0000 (09:51 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 26 Jun 2008 09:51:55 +0000 (09:51 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11454 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/opsi.pm | patch | blob | history |
index f8aa012a9ef3f0c92b6ef56e655678fcf533a7a8..9d3f0dfffd3386aabdb60849a2e05f2ccb048e39 100644 (file)
use Data::Dumper;
use GOSA::GosaSupportDaemon;
use JSON::RPC::Client;
+use XML::Quote qw(:all);
BEGIN {}
if (check_res($sres)){
my $tres= $sres->result;
- my $name= $tres->{'name'};
- my $description= $tres->{'description'};
+ my $name= xml_quote($tres->{'name'});
+ my $description= xml_quote($tres->{'description'});
$name=~ s/\//\\\//;
$description=~ s/\//\\\//;
$xml_msg=~ s/<xxx><\/xxx>/<item><ProductId>$r<\/ProductId><name><\/name><description>$description<\/description><\/item><xxx><\/xxx>/;
my $value = $r->{$key};
if (UNIVERSAL::isa( $value, "ARRAY" )){
foreach my $subval (@{$value}){
- $item.= "<$key>$subval</$key>";
+ $item.= "<$key>".xml_quote($subval)."</$key>";
}
} else {
- $item.= "<$key>$value</$key>";
+ $item.= "<$key>".xml_quote($value)."</$key>";
}
}
$item.= "</item>";
&add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
}
+# Produkt
+# Property
+# Wert
+# <ProductId>ntfs-restore-image</ProductId>
+# <item>
+# <name>askbeforeinst</name>
+# <value>false</value>
+# </item>
+
# return message
return &create_xml_string($out_hash);
}
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 = @{$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);
if (defined $forward_to_gosa) {
- &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
+ &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
}
+ &add_content2xml_hash($out_hash, "hostId", "$hostId");
+ &add_content2xml_hash($out_hash, "xxx", "");
+ my $xml_msg= &create_xml_string($out_hash);
- # return message
- return &create_xml_string($out_hash);
+ # JSON Query
+ my $callobj = {
+ method => 'getHardwareInformation_hash',
+ params => [ $hostId ],
+ id => 1,
+ };
+
+ my $res = $client->call($opsi_url, $callobj);
+ if (check_res($res)){
+ my $result= $res->result;
+ foreach my $r (keys %{$result}){
+ my $item= "<item><name>".xml_quote($r)."</name>";
+ my $value= $result->{$r};
+ foreach my $sres (@{$value}){
+
+ foreach my $dres (keys %{$sres}){
+ if (defined $sres->{$dres}){
+ $item.= "<$dres>".xml_quote($sres->{$dres})."</$dres>";
+ }
+ }
+
+ $item.= "</item>";
+ $xml_msg=~ s/<xxx><\/xxx>/$item<xxx><\/xxx>/;
+
+ }
+ }
+ }
+
+ $xml_msg=~ s/<xxx><\/xxx>//;
+
+ return $xml_msg;
}
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 = @{$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);
if (defined $forward_to_gosa) {
- &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
+ &add_content2xml_hash($out_hash, "forward_to_gosa", $forward_to_gosa);
}
+ &add_content2xml_hash($out_hash, "hostId", "$hostId");
+ &add_content2xml_hash($out_hash, "xxx", "");
+ my $xml_msg= &create_xml_string($out_hash);
- # return message
- return &create_xml_string($out_hash);
+ # JSON Query
+ my $callobj = {
+ method => 'getSoftwareInformation_hash',
+ params => [ $hostId ],
+ id => 1,
+ };
+
+ my $res = $client->call($opsi_url, $callobj);
+ if (check_res($res)){
+ my $result= $res->result;
+ }
+
+ $xml_msg=~ s/<xxx><\/xxx>//;
+
+ return $xml_msg;
}
my $description= $tres->{'description'};
$name=~ s/\//\\\//;
$description=~ s/\//\\\//;
- $xml_msg=~ s/<xxx><\/xxx>/<item><id>$r<\/id><name><\/name><description>$description<\/description><\/item><xxx><\/xxx>/;
+ $xml_msg=~ s/<xxx><\/xxx>/<item><id>".xml_quote($r).<\/id><name><\/name><description>".xml_quote($description)."<\/description><\/item><xxx><\/xxx>/;
}
}