summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93b5514)
raw | patch | inline | side by side (parent: 93b5514)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 11 Jul 2008 14:53:51 +0000 (14:53 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 11 Jul 2008 14:53:51 +0000 (14:53 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11613 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/opsi.pm | patch | blob | history |
index f9d740e45d736bc70c2a6fb01ae26a3c8ba56ec4..9e016e0c354f1679e27539f3214be941e0ae4ba7 100644 (file)
"opsi_get_client_software",
"opsi_get_product_properties",
"opsi_set_product_properties",
-
- #"opsi_list_clients",
- # Clients auflisten. Rückgabe -> name, dsecription
- #getClients_listOfHashes
+ "opsi_list_clients",
+ "opsi_del_client",
+ "opsi_install_client",
#"opsi_add_client",
# Client hinzufügen
# -> Description
# -> Notizen
- #"opsi_del_client",
+ #"opsi_modify_client",
#"opsi_add_product_to_client",
# -> set product state auf "setup"
# -> delete nur wenn eine "uninstall" methode existiert
# -> set product state auf "none"
- #"opsi_install_client",
- # Setze alles was auf "installed" steht auf setup
-
);
@EXPORT = @events;
id => 1,
};
- my $res = $client->call($opsi_url, $callobj);
+ $res = $client->call($opsi_url, $callobj);
if (check_res($res)){
my $r= $res->result;
}
+sub opsi_list_clients {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ my $target = @{$msg_hash->{'target'}}[0];
+ my $session_id = @{$msg_hash->{'session_id'}}[0];
+ my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[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, "xxx", "");
+ my $xml_msg= &create_xml_string($out_hash);
+
+ # JSON Query
+ my $callobj = {
+ method => 'getClients_listOfHashes',
+ params => [ ],
+ id => 1,
+ };
+
+ my $res = $client->call($opsi_url, $callobj);
+ if (check_res($res)){
+
+ foreach my $host (@{$res->result}){
+ my $item= "<item><name>".$host->{'hostId'}."</name>";
+ if (defined($host->{'description'})){
+ $item.= "<description>".xml_quote($host->{'description'})."</description>";
+ }
+ $item.= "</item>";
+ $xml_msg=~ s%<xxx></xxx>%$item<xxx></xxx>%;
+ }
+
+ }
+
+ $xml_msg=~ s/<xxx><\/xxx>//;
+ return $xml_msg;
+}
+
+
sub opsi_get_client_software {
my ($msg, $msg_hash) = @_;
my $header = @{$msg_hash->{'header'}}[0];
}
+sub opsi_del_client {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ 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, "hostId", "$hostId");
+
+ # JSON Query
+ my $callobj = {
+ method => 'deleteClient',
+ params => [ $hostId ],
+ id => 1,
+ };
+
+ my $res = $client->call($opsi_url, $callobj);
+
+ my $xml_msg= &create_xml_string($out_hash);
+ return $xml_msg;
+}
+
+
+# Setze alles was auf "installed" steht auf setup
+sub opsi_install_client {
+ my ($msg, $msg_hash) = @_;
+ my $header = @{$msg_hash->{'header'}}[0];
+ my $source = @{$msg_hash->{'source'}}[0];
+ 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, "hostId", "$hostId");
+
+# Schaue nach produkten für diesen Host
+# Setze alle Produkte dieses Hosts auf "setup"
+
+# # JSON Query
+# my $callobj = {
+# method => 'deleteClient',
+# params => [ $hostId ],
+# id => 1,
+# };
+#
+# my $res = $client->call($opsi_url, $callobj);
+
+ my $xml_msg= &create_xml_string($out_hash);
+ return $xml_msg;
+}
+
+
sub _set_action {
my $product= shift;
my $action = shift;