index b06f3f2ef0f159201910f7c0ef5bbe2efcb7fb0b..7ee752072f553f6f864efb872c32985b4e4a3829 100644 (file)
use Net::LDAP;
use Socket;
use Net::hostent;
-use utf8;
my $event_dir = "/usr/lib/gosa-si/server/events";
use lib "/usr/lib/gosa-si/server/events";
if ($header eq 'new_key') {
@out_msg_l = &new_key($msg_hash)
} elsif ($header eq 'here_i_am') {
- @out_msg_l = &here_i_am($msg_hash, $session_id)
+ @out_msg_l = &here_i_am($msg, $msg_hash, $session_id)
} else {
if( exists $event_hash->{$header} ) {
# a event exists with the header as name
# DESCRIPTION: process this incoming message
#===============================================================================
sub here_i_am {
- my ($msg_hash, $session_id) = @_;
+ my ($msg, $msg_hash, $session_id) = @_;
my @out_msg_l;
my $out_hash;
push(@out_msg_l, $new_ldap_config_out);
}
- my $hardware_config_out = &hardware_config($source, $gotoHardwareChecksum);
+ my $hardware_config_out = &hardware_config($msg, $msg_hash, $session_id);
if( $hardware_config_out ) {
push(@out_msg_l, $hardware_config_out);
}
# DESCRIPTION:
#===============================================================================
sub hardware_config {
- my ($address, $gotoHardwareChecksum) = @_ ;
+ my ($msg, $msg_hash, $session_id) = @_ ;
+ my $address = @{$msg_hash->{source}}[0];
+ my $header = @{$msg_hash->{header}}[0];
+ my $gotoHardwareChecksum = @{$msg_hash->{gotoHardwareChecksum}}[0];
my $sql_statement= "SELECT * FROM known_clients WHERE hostname='$address'";
my $res = $main::known_clients_db->select_dbentry( $sql_statement );
if( not $hit_counter == 1 ) {
&main::daemon_log("ERROR: more or no hit found in known_clients_db by query by '$address'", 1);
}
-
my $macaddress = $res->{1}->{macaddress};
my $hostkey = $res->{1}->{hostkey};
$data{'goto_secret'}= $goto_secret;
}
- &main::daemon_log("Send detect_hardware message to $address", 4);
+ # set status = hardware_detection at jobqueue if entry exists
+ my $func_dic = {table=>$main::job_queue_tn,
+ primkey=>['id'],
+ timestamp=>&get_time,
+ status=>'processing',
+ result=>'none',
+ progress=>'hardware-detection',
+ headertag=>$header,
+ targettag=>$address,
+ xmlmessage=>$msg,
+ macaddress=>$macaddress,
+ };
+ my $hd_res = $main::job_db->add_dbentry($func_dic);
+ &main::daemon_log("$session_id INFO: add '$macaddress' to job queue as an installing job", 5);
# Send information
+ &main::daemon_log("$session_id INFO: Send detect_hardware message to $address", 5);
return &build_msg("detect_hardware", $server_address, $address, \%data);
}