From 740e96df84e576250323b0a384709054b0504d96 Mon Sep 17 00:00:00 2001 From: janw Date: Mon, 14 Apr 2008 15:00:04 +0000 Subject: [PATCH] Added server event get_available kernel. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10434 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/server/events/gosaTriggered.pm | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 6138e547d..0d4861e58 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -29,6 +29,7 @@ my @events = ( "trigger_action_wake", "recreate_fai_server_db", "send_user_msg", + "get_available_kernel", ); @EXPORT = @events; @@ -643,4 +644,31 @@ sub trigger_action_wake { } +sub get_available_kernel { + my ($msg, $msg_hash, $session_id) = @_; + + my $source = @{$msg_hash->{'source'}}[0]; + my $target = @{$msg_hash->{'target'}}[0]; + my $server = @{$msg_hash->{'server'}}[0]; + + # Get available Releases for server + my $sql_statement = "SELECT * FROM $main::fai_server_tn WHERE server LIKE '%$server%'"; + my $res_hash = $main::fai_server_db->select_dbentry($sql_statement); + + my @kernel; + foreach my $release (keys %{$res_hash}) { + # Get Kernel packages for release + my $sql_statement = "SELECT * FROM $main::packages_list_tn WHERE distribution='".$res_hash->{$release}->{'release'}."' AND package LIKE 'linux\-image\-%'"; + my $hash = $main::packages_list_db->select_dbentry($sql_statement); + foreach my $package (keys %{$hash}) { + push @kernel, (%{$res_hash}->{$release}->{'release'})."|".(%{$hash}->{$package}->{'package'}); + } + } + + my %data = ('available-kernel' => \@kernel); + + my $out_msg = &build_msg("get_available_kernel", $target, "GOSA", \%data); + return ( $out_msg ); +} + 1; -- 2.30.2