summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cff8674)
raw | patch | inline | side by side (parent: cff8674)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 4 Aug 2008 15:34:45 +0000 (15:34 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 4 Aug 2008 15:34:45 +0000 (15:34 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12145 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/client/events/opsi.pm | patch | blob | history | |
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/tests/client.php | patch | blob | history |
index 82bf4f88d60b3ed6204391b67ed361d05066359f..0b5e91032e094033b6aa5c14e52d7a5b8cfea6a3 100644 (file)
"password" => [\$opsi_password, "secret"],
},
);
-&read_configfile($main::cfg_file, %cfg_defaults);
+&GOSA::GosaSupportDaemon::read_configfile($main::cfg_file, %cfg_defaults);
# Assemble opsi URL
my $opsi_url= "https://".$opsi_admin.":".$opsi_password."@".$opsi_server.":4447/rpc";
my $client = new JSON::RPC::Client;
+
sub check_res {
my $res= shift;
# TODO: We need to return the outhash!?
}
-sub read_configfile {
- my ($cfg_file, %cfg_defaults) = @_;
- my $cfg;
-
- if( defined( $cfg_file) && ( (-s $cfg_file) > 0 )) {
- if( -r $cfg_file ) {
- $cfg = Config::IniFiles->new( -file => $cfg_file );
- } else {
- &main::daemon_log("ERROR: opsi.pm couldn't read config file!", 1);
- }
- } else {
- $cfg = Config::IniFiles->new() ;
- }
- foreach my $section (keys %cfg_defaults) {
- foreach my $param (keys %{$cfg_defaults{ $section }}) {
- my $pinfo = $cfg_defaults{ $section }{ $param };
- ${@$pinfo[0]} = $cfg->val( $section, $param, @$pinfo[1] );
- }
- }
-}
-
-
sub get_events { return \@events; }
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index dc72ee5b1d09f8462f1f4f7728d73f9fb44bfa57..cba9f598792a8bca994c45a628c090612ccf63d5 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
}
-#=== FUNCTION ================================================================
-# NAME: read_configfile
-# PARAMETERS: cfg_file - string -
-# RETURNS:
-# DESCRIPTION:
-#===============================================================================
-sub read_configfile {
- my ($cfg_file, %cfg_defaults) = @_ ;
- my $cfg;
- if( defined( $cfg_file) && ( (-s $cfg_file) > 0 )) {
- if( -r $cfg_file ) {
- $cfg = Config::IniFiles->new( -file => $cfg_file );
- } else {
- print STDERR "Couldn't read config file!";
- }
- } else {
- $cfg = Config::IniFiles->new() ;
- }
- foreach my $section (keys %cfg_defaults) {
- foreach my $param (keys %{$cfg_defaults{ $section }}) {
- my $pinfo = $cfg_defaults{ $section }{ $param };
- ${@$pinfo[ 0 ]} = $cfg->val( $section, $param, @$pinfo[ 1 ] );
- }
- }
-}
-
-
#=== FUNCTION ================================================================
# NAME: check_pid
# PARAMETERS:
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index 1a79a57830bfb44b6138d1da1a439bcf9d7800b8..e273e9e0c04ef50dc78e664131fba949c20a25f2 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
my $max_children = 2;
+# loop delay for job queue to look for opsi jobs
+my $job_queue_opsi_delay = 2;
+
+
%cfg_defaults = (
"general" => {
"log-file" => [\$log_file, "/var/run/".$prg.".log"],
}
}
} else {
- daemon_log("get_local_ip_for_remote_ip was called with a non-ip parameter: $remote_ip", 1);
+ daemon_log("0 WARNING: get_local_ip_for_remote_ip() was called with a non-ip parameter: '$remote_ip'", 1);
}
return $result;
}
$kernel->delay_set('watch_for_new_jobs', $job_queue_loop_delay);
$kernel->delay_set('watch_for_done_jobs', $job_queue_loop_delay);
$kernel->delay_set('watch_for_modified_jobs', $modified_jobs_loop_delay);
+ $kernel->delay_set('watch_for_opsi_jobs', $job_queue_opsi_delay);
$kernel->delay_set('watch_for_new_messages', $messaging_db_loop_delay);
$kernel->delay_set('watch_for_delivery_messages', $messaging_db_loop_delay);
$kernel->delay_set('watch_for_done_messages', $messaging_db_loop_delay);
}
+sub watch_for_opsi_jobs {
+ my ($kernel) = @_[KERNEL];
+
+ my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE ((headertag='opsi_install_client') AND (status='processing'))";
+ my $res = $job_db->select_dbentry( $sql_statement );
+
+ while (my ($id, $hit) = each %$res ) {
+
+ # Ask OPSI for an update of the running jobs
+ my $hostId = $hit->{'plainname'};
+ print STDERR "\n\n$hostId\n";
+# my $result= {};
+#
+# # For hosts, only return the products that are or get installed
+# my $callobj;
+# $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
+# my $products= 0;
+# my $installed= 0;
+# my $error= 0;
+# foreach my $product (@{$htmp}){
+#
+# if ($product->{'installationStatus'} ne "not_installed" or
+# $product->{'actionRequest'} eq "setup"){
+#
+# # Increase number of products for this host
+# $products++;
+#
+# if ($product->{'installationStatus'} eq "failed"){
+# $result->{$product->{'productId'}}= "error";
+# $error++;
+# }
+# if ($product->{'installationStatus'} eq "installed"){
+# $result->{$product->{'productId'}}= "installed";
+# $installed++;
+# }
+# if ($product->{'installationStatus'} eq "installing"){
+# $result->{$product->{'productId'}}= "installing";
+# }
+# }
+# }
+#
+# # Estimate "rough" progress
+# $result->{'progress'}= int($installed * 100 / $products);
+#}
+#
+#return $result;
+#
+ }
+
+ $kernel->delay_set('watch_for_opsi_jobs', $job_queue_opsi_delay);
+}
+
+
# if a job got an update or was modified anyway, send to all other si-server an update message
# of this jobs
sub watch_for_modified_jobs {
}
-
sub watch_for_new_messages {
my ($kernel,$heap) = @_[KERNEL, HEAP];
my @coll_user_msg; # collection list of outgoing messages
close (CONFIG);
+
find(\&cleanup_and_extract, keys( %repo_dirs ));
&main::strip_packages_list_statements();
unshift @packages_list_statements, "VACUUM";
if( -f "$dir/DEBIAN/templates" ) {
- daemon_log("DEBUG: Found debconf templates in '$package' - $newver", 5);
+ daemon_log("DEBUG: Found debconf templates in '$package' - $newver", 7);
my $tmpl= "";
{
watch_for_new_jobs => \&watch_for_new_jobs,
watch_for_modified_jobs => \&watch_for_modified_jobs,
watch_for_done_jobs => \&watch_for_done_jobs,
+ watch_for_opsi_jobs => \&watch_for_opsi_jobs,
watch_for_old_known_clients => \&watch_for_old_known_clients,
create_packages_list_db => \&run_create_packages_list_db,
create_fai_server_db => \&run_create_fai_server_db,
index f94db5dfec0b963af12194bc2b1ca5a062b1c45f..ecc70afb106abe3119f84e77fe9190ffd807615d 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
#$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source> <target>GOSA</target> <hostname>localhost</hostname> </xml>";
- ########
+ ####################################################################
# Opsi testing
# Get all netboot products
#$data = "<xml> <header>gosa_opsi_get_netboot_products</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> </xml>";
# Get netboot product for specific host
- # -->
#$data = "<xml> <header>gosa_opsi_get_netboot_products</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <hostId>limux-cl-2.intranet.gonicus.de</hostId></xml>";
# Get all localboot products
#$data = "<xml> <header>gosa_opsi_del_client</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <hostId>sdfgsg.intranet.gonicus.de</hostId></xml>";
# Install Opsi client
- $data = "<xml> <header>gosa_opsi_install_client</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> <hostId>limux-cl-2.intranet.gonicus.de</hostId></xml>";
+ $data = "<xml> <header>gosa_opsi_install_client</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <hostId>limux-cl-2.intranet.gonicus.de</hostId> <macaddress>11:22:33:44:55:66</macaddress> </xml>";
#########################
########################
# DAK Debian Archive Kit
- $data = "<xml> <header>gosa_get_dak_keyring</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> </xml>";
+ #$data = "<xml> <header>gosa_get_dak_keyring</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> </xml>";
#$data = "<xml> <header>gosa_import_dak_key</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> </xml>";
#$data = "<xml> <header>gosa_remove_dak_key</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> </xml>";