index 6cdfd7f7d2c98bce5a80c71f21e70bb1e2a28c5f..7425bfbac4690a6e232317d12598f3c1f3e17e65 100644 (file)
use Exporter;
@ISA = qw(Exporter);
my @events = (
+ "confirm_usr_msg",
"PROGRESS",
"FAIREBOOT",
"TASKSKIP",
}
+sub confirm_usr_msg {
+ my ($msg, $msg_hash, $session_id) = @_;
+ my $message = @{$msg_hash->{'message'}}[0];
+ my $subject = @{$msg_hash->{'subject'}}[0];
+ my $usr = @{$msg_hash->{'usr'}}[0];
+
+ # set update for this message
+ my $sql = "UPDATE $main::messaging_tn SET flag='s' WHERE (message='$message' AND subject='$subject' AND message_to='$usr')";
+ &main::daemon_log("$session_id DEBUG: $sql", 7);
+ my $res = $main::messaging_db->exec_statement($sql);
+
+
+ return;
+}
+
+
+
sub read_configfile {
my ($cfg_file, %cfg_defaults) = @_;
my $cfg;
- if( defined( $cfg_file) && ( length($cfg_file) > 0 )) {
+ if( defined( $cfg_file) && ( (-s $cfg_file) > 0 )) {
if( -r $cfg_file ) {
$cfg = Config::IniFiles->new( -file => $cfg_file );
} else {
}
}
- # in case of no and more than one running jobs in queue, add on single job
+ # in case of no and more than one running jobs in queue, add one single job
+ # resolve plain name for host $macaddress
+ my $plain_name;
+ my $ldap_handle = &main::get_ldap_handle($session_id);
+ if( not defined $ldap_handle ) {
+ &main::daemon_log("$session_id ERROR: cannot connect to ldap", 1);
+ $plain_name = "none";
+
+ # try to fetch a 'real name'
+ } else {
+ my $mesg = $ldap_handle->search(
+ base => $main::ldap_base,
+ scope => 'sub',
+ attrs => ['cn'],
+ filter => "(macAddress=$macaddress)");
+ if($mesg->code) {
+ &main::daemon_log($mesg->error, 1);
+ $plain_name = "none";
+ } else {
+ my $entry= $mesg->entry(0);
+ $plain_name = $entry->get_value("cn");
+ }
+ }
+
+
&main::daemon_log("$session_id DEBUG: add job to queue for host '$macaddress'", 7);
my $func_dic = {table=>$main::job_queue_tn,
- primkey=>['id'],
+ primkey=>[],
timestamp=>&get_time,
status=>'processing',
result=>"$header $content",
targettag=>$source,
xmlmessage=>'none',
macaddress=>$macaddress,
+ plainname=>$plain_name,
};
my ($err, $error_str) = $main::job_db->add_dbentry($func_dic);
if ($err != 0) {