summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d4830a)
raw | patch | inline | side by side (parent: 3d4830a)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 22 Jun 2009 15:37:21 +0000 (15:37 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 22 Jun 2009 15:37:21 +0000 (15:37 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13762 594d385d-05f5-0310-b6e9-bd551577e9d8
index bfe3a24ab60d3ac56d1aa026a4ffdc1af7637faf..82040804eb4ec84d1a76c23ef9145b8f90ad19a8 100644 (file)
my ($rand_fh, $rand_file) = tempfile( SUFFIX => '.goto_notify');
print $rand_fh "source:$source\ntarget:$target\nusr:$to\nsubject:".@{$msg_hash->{'subject'}}[0]."\nmessage:".@{$msg_hash->{'message'}}[0]."\n";
close $rand_fh;
-
- my $feedback = system("/usr/bin/goto-notify user-message '$to' '$subject' '$message' '$rand_file' &" );
+
+ my ($host, $port) = split(':', $target);
+ my $feedback = system("/usr/bin/goto-notify user-message '$to' '$subject' '$message' '$rand_file' '$host' &" );
return
}
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index be587d2700a65f0d7216157a71defd54aa17daa4..8e7f37918bb0331802da5a19d64f2114f7c1e6e5 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
"plainname VARCHAR(255) DEFAULT 'none'",
"siserver VARCHAR(255) DEFAULT 'none'",
"modified INTEGER DEFAULT '0'",
+ "periodic VARCHAR(6) DEFAULT 'none'",
);
# holds all other gosa-si-server
# List of month names, used in function daemon_log
my @monthnames = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
+# List of accepted periodical xml tags related to cpan modul DateTime
+our $check_periodic = {"months"=>'', "weeks"=>'', "days"=>'', "hours"=>'', "minutes"=>''};
+
+
%cfg_defaults = (
"general" => {
"log-file" => [\$log_file, "/var/run/".$prg.".log"],
$msg =~ s/<header>gosa_/<header>/;
my $error= &send_msg_to_target($msg, $hostname, $hostkey, $header, $session_id);
if ($error) {
- &daemon_log("$session_id ERROR: Some problems occurred while trying to send msg to client '$hostkey': $msg", 1);
+ &daemon_log("$session_id ERROR: Some problems occurred while trying to send msg to client '$hostname': $msg", 1);
}
}
else
sub watch_for_done_jobs {
- #CHECK: $heap for what?
- my ($kernel,$heap) = @_[KERNEL, HEAP];
+ my $kernel = $_[KERNEL];
my $sql_statement = "SELECT * FROM ".$job_queue_tn." WHERE ((status='done') AND (modified='0'))";
my $res = $job_db->select_dbentry( $sql_statement );
- while( my ($id, $hit) = each %{$res} ) {
- my $jobdb_id = $hit->{id};
- my $sql_statement = "DELETE FROM $job_queue_tn WHERE id=$jobdb_id";
- my $res = $job_db->del_dbentry($sql_statement);
+ while( my ($number, $hit) = each %{$res} )
+ {
+ # Periodical jobs should not be deleted but reactivated with new timestamp instead.
+ if (exists $check_periodic->{$hit->{periodic}})
+ {
+ my $reactivated_ts = $hit->{timestamp};
+ my $act_ts = int(&get_time());
+ while ($act_ts > int($reactivated_ts)) # Redo calculation to avoid multiple jobs in the past
+ {
+ $reactivated_ts = &calc_timestamp($reactivated_ts, "plus", 1, $hit->{periodic});
+ }
+ my $sql = "UPDATE $job_queue_tn SET status='waiting', timestamp='$reactivated_ts' WHERE id='".$hit->{id}."'";
+ my $res = $job_db->exec_statement($sql);
+ &daemon_log("J INFO: Update periodical job '".$hit->{headertag}."' for client '".$hit->{targettag}."'. New execution time '$reactivated_ts'.", 5);
+ }
+ # Non periodical jobs can be deleted.
+ else
+ {
+ my $jobdb_id = $hit->{id};
+ my $sql_statement = "DELETE FROM $job_queue_tn WHERE id=$jobdb_id";
+ my $res = $job_db->del_dbentry($sql_statement);
+ }
}
$kernel->delay_set('watch_for_done_jobs',$job_queue_loop_delay);
my $func_error = &send_msg_to_target($job_msg, $server_address, $GosaPackages_key, $header, "J");
# update status in job queue to ...
- # ... 'processing', for jobs: 'reinstall', 'update'
+ # ... 'processing', for jobs: 'reinstall', 'update', activate_new
if (($header =~ /gosa_trigger_action_reinstall/)
|| ($header =~ /gosa_trigger_activate_new/)
|| ($header =~ /gosa_trigger_action_update/)) {
# ... 'done', for all other jobs, they are no longer needed in the jobqueue
else {
my $sql_statement = "UPDATE $job_queue_tn SET status='done' WHERE id=$jobdb_id";
- my $dbres = $job_db->update_dbentry($sql_statement);
+ my $dbres = $job_db->exec_statement($sql_statement);
}
index ea5bc2a517deca1db8650a1799da8fe916764c1f..88b2910086b47a587154458d62354b749025686f 100644 (file)
"<answer1>1</answer1>".
"<error_string>no mac address specified, neither in target-tag nor in macaddres-tag</error_string>".
"</xml>";
+
+ return ($out_msg);
}
# Determine plain_name for host
&main::release_ldap_handle($ldap_handle);
}
+ # Check if it is a periodical job
+ my $periodic = 'none';
+ if (exists $msg_hash->{periodic})
+ {
+ $periodic = $msg_hash->{periodic}[0];
+ if (not defined $periodic) # Periodic tag is not defined
+ {
+ $periodic = "";
+ }
+
+ if (not exists $main::check_periodic->{$periodic}) # Periodic tag is not valid
+ {
+ &main::daemon_log("$session_id ERROR: Message contains invalid periodic-tag '$periodic'.".
+ " Please use one of the following tags instead: '".join("', '", keys(%$main::check_periodic))."'.".
+ " Aborted message: $msg", 1);
+ $out_msg = "<xml>".
+ "<header>answer</header><source>$main::server_address</source><target>GOSA</target>".
+ "<answer1>1</answer1><error_string>Message contains invalid periodic-tag '$periodic'</error_string>".
+ "</xml>";
+ return ($out_msg);
+ }
+ }
+
# Add job to job queue
if( $error == 0 ) {
my $func_dic = {table=>$main::job_queue_tn,
plainname=>$plain_name,
siserver=>"localhost",
modified=>"1",
+ periodic=>$periodic,
};
my $res = $main::job_db->add_dbentry($func_dic);
if (not $res == 0) {
index 526afd36c146285bf6738cf59da4d31fec0813ae..566ba0e5726d63c78360b892847aecdf9b1bef3e 100644 (file)
}
sub calc_timestamp {
- my ($timestamp, $operation, $value) = @_ ;
+ my ($timestamp, $operation, $value, $entity) = @_ ;
+ $entity = defined $entity ? $entity : "seconds";
my $res_timestamp = 0;
$value = int($value);
);
if ($operation eq "plus" || $operation eq "+") {
- $dt->add( seconds => $value);
+ $dt->add($entity => $value);
$res_timestamp = $dt->ymd('').$dt->hms('');
}
if ($operation eq "minus" || $operation eq "-") {
- $dt->subtract(seconds => $value);
+ $dt->subtract($entity => $value);
$res_timestamp = $dt->ymd('').$dt->hms('');
}
index ac934d53bde4e33c9e5280ccb719eedf0b8d10ae..881ebb8209468c36b0a6d064f226fec7d8142c1e 100644 (file)
#}
# set job to status 'done', job will be deleted automatically
- my $sql_statement = "UPDATE $main::job_queue_tn ".
- "SET status='done', modified='1' ".
- "$where";
+ my $sql_statement = "UPDATE $main::job_queue_tn SET status='done', modified='1', periodic='none' $where";
&main::daemon_log("$session_id DEBUG: $sql_statement", 7);
my $res = $main::job_db->update_dbentry( $sql_statement );
index 5b645e85950e79bf8599a1bcdc9a230f26a4c2a1..2a54b86e0148cc563cf62983582c4b7efda23a6f 100644 (file)
my $delivery_time = @{$msg_hash->{'delivery_time'}}[0];
my $message = @{$msg_hash->{'message'}}[0];
- # keep job queue uptodate if necessary
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # keep job queue uptodate if necessary
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
# error handling
if (not $delivery_time =~ /^\d{14}$/) {
my ($msg, $msg_hash, $session_id) = @_ ;
my $out_msg;
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
$main::fai_server_db->create_table("new_fai_server", \@main::fai_server_col_names);
&main::create_fai_server_db("new_fai_server",undef,"dont", $session_id);
my ($msg, $msg_hash, $session_id) = @_ ;
my $out_msg;
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
$main::fai_release_db->create_table("new_fai_release", \@main::fai_release_col_names);
&main::create_fai_release_db("new_fai_release", $session_id);
my ($msg, $msg_hash, $session_id) = @_ ;
my $out_msg;
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
&main::create_packages_list_db;
my $target = @{$msg_hash->{'target'}}[0];
my $client = @{$msg_hash->{'client'}}[0];
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
# If $client is a mac address
if ($client =~ /^\w\w:\w\w:\w\w:\w\w:\w\w:\w\w$/i)
my $target = @{$msg_hash->{'target'}}[0];
my $usr = @{$msg_hash->{'usr'}}[0];
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
# Search for clients where $usr is logged in
my $sql_statement = "SELECT * FROM $main::login_users_tn WHERE user LIKE '%$usr%'";
my $mac = @{$msg_hash->{macaddress}}[0];
my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
+ my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
&main::daemon_log("$session_id DEBUG: $sql_statement", 7);
my $res = $main::job_db->exec_statement($sql_statement);
}
my $macaddress = @{$msg_hash->{macaddress}}[0];
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
my $out_msg = &ClientPackages::new_syslog_config($macaddress, $session_id);
my @out_msg_l = ( $out_msg );
my $macaddress = @{$msg_hash->{macaddress}}[0];
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
my $out_msg = &ClientPackages::new_ntp_config($macaddress, $session_id);
my @out_msg_l = ( $out_msg );
my ($msg, $msg_hash, $session_id) = @_ ;
my $mac = @{$msg_hash->{macaddress}}[0];
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
my $out_msg = &ClientPackages::new_ldap_config($mac, $session_id);
my @out_msg_l = ( $out_msg );
my $header = @{$msg_hash->{header}}[0];
my $source = @{$msg_hash->{source}}[0];
my $mac= (defined($msg_hash->{'macaddress'}))?@{$msg_hash->{'macaddress'}}[0]:undef;
+ my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
my @out_msg_l;
# TODO Sanity check macAddress defined
- # update status of job
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # update status of job
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
# If a client gets a 'set_activated_for_installation' msg, always deliver a fresh 'new_ldap_config'
# just for backup and robustness purposes
&main::change_goto_state('locked', \@{$msg_hash->{macaddress}}, $session_id);
&main::change_fai_state('install', \@{$msg_hash->{macaddress}}, $session_id);
- # Set job to status 'done', job will be deleted automatically
- my $sql_statement = "UPDATE $main::job_queue_tn ".
- "SET status='done', modified='1'".
- "WHERE (macaddress LIKE '$mac' AND status='processing')";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->update_dbentry( $sql_statement );
+# # Set job to status 'done', job will be deleted automatically
+# my $sql_statement = "UPDATE $main::job_queue_tn ".
+# "SET status='done', modified='1'".
+# "WHERE (macaddress LIKE '$mac' AND status='processing')";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->update_dbentry( $sql_statement );
return ( $out_msg );
}
# Set LDAP state
&main::change_goto_state('locked', \@{$msg_hash->{macaddress}}, $session_id);
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
return;
}
# Set LDAP state
&main::change_goto_state('active', \@{$msg_hash->{macaddress}}, $session_id);
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
# Create message for client
my $out_hash = &create_xml_hash("set_activated_for_installation", $source, $mac);
# Set LDAP state
&main::change_fai_state('localboot', \@{$msg_hash->{macaddress}}, $session_id);
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
return @out_msg_l;
}
# Create message for client
my $out_msg = &main::create_xml_string(&main::create_xml_hash("trigger_action_halt", $source, $mac));
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
return ($out_msg);
}
# Set LDAP state
&main::change_fai_state('reboot', \@{$msg_hash->{macaddress}}, $session_id);
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
-
return ($out_msg);
}
# Set LDAP state
&main::change_fai_state('update', \@{$msg_hash->{macaddress}}, $session_id);
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
# Create wakeup message for all foreign server
my %data = ( 'macaddress' => \@{$msg_hash->{macaddress}} );
# Create message for client
my $out_msg = &main::create_xml_string(&main::create_xml_hash("new_key", $source, $mac));
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
return ($out_msg);
}
# Create message for client
my $out_msg = &main::create_xml_string(&main::create_xml_hash("detect_hardware", $source, $mac));
- # Set job status
- my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+# # Set job status
+# my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
return ( $out_msg );
}
sub trigger_action_wake {
my ($msg, $msg_hash, $session_id) = @_;
-
- # Set job status
my $jobdb_id = @{$msg_hash->{'jobdb_id'}}[0];
- if( defined $jobdb_id) {
- my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE id=$jobdb_id";
- &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
- my $res = $main::job_db->exec_statement($sql_statement);
- }
+
+# # Set job status
+# if( defined $jobdb_id) {
+# my $sql_statement = "UPDATE $main::job_queue_tn SET status='processed' WHERE ((id=$jobdb_id) AND (NOT status='done'))";
+# &main::daemon_log("$session_id DEBUG: $sql_statement", 7);
+# my $res = $main::job_db->exec_statement($sql_statement);
+# }
# Create wakeup message for all foreign server
my $out_hash = &create_xml_hash("trigger_wake", "GOSA", "KNOWN_SERVER");
index a6e88f97a32955d5a97faf9f64a3fe3777d3d99b..cad44ef304f8ca0c8caf7eb9a3b2868f6e0712e5 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
if($sock->connected()){
+ ##############################
+ # periodical jobs
+ $data = "<xml><header>job_trigger_action_reboot</header><source>GOSA</source><target>00:0c:29:4c:4b:0c</target><macaddress>00:0c:29:4c:4b:0c</macaddress><timestamp>20090622000000</timestamp><periodic>minutes</periodic></xml>";
+
/* Prepare a hunge bunch of data to be send */
# jobdb add
#$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
#$data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>rettenbe</usr></xml>";
# List all si-server providing opsi
- $data = "<xml> <header>gosa_get_hosts_with_module</header> <source>GOSA</source> <target>linux-cl-7:20081</target> <module_name>opsi</module_name> </xml>";
+ #$data = "<xml> <header>gosa_get_hosts_with_module</header> <source>GOSA</source> <target>linux-cl-7:20081</target> <module_name>opsi</module_name> </xml>";
# Send messages to a user and displayed message via konch
#$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <user>polle</user> <user>harald</user> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>";
-
$sock->write($data);
$answer = "nothing";
$answer = $sock->read();