index 21db30a5974acedb2677887fe3bb5df3828f0b34..ae94225520dbe79d3449fec53d9d05e68e85c6b2 100644 (file)
"get_interfaces",
"is_local",
"run_as",
+ "inform_all_other_si_server",
);
@EXPORT = @functions;
use strict;
my @xml_tags = keys %{$phrase};
my $tag = $xml_tags[0];
my $val = $phrase->{$tag}[0];
+ if( ref($val) eq "HASH" ) { next; } # empty xml-tags should not appear in where statement
+
# integer columns do not have to have single quotes besides the value
if ($tag eq "id") {
push(@phrase_l, "$tag$operator$val");
push(@phrase_l, "$tag$operator'$val'");
}
}
- my $clause_str .= join(" $connector ", @phrase_l);
- push(@clause_l, "($clause_str)");
+
+ if (not 0 == @phrase_l) {
+ my $clause_str .= join(" $connector ", @phrase_l);
+ push(@clause_l, "($clause_str)");
+ }
}
if( not 0 == @clause_l ) {
}
-#############################################
-# moved from gosa-si-client: rettenbe, 16.05.2008
-# outcommented at gosa-si-client
sub get_server_addresses {
my $domain= shift;
my @result;
}
+#=== FUNCTION ================================================================
+# NAME: inform_other_si_server
+# PARAMETERS: message
+# RETURNS: nothing
+# DESCRIPTION: Sends message to all other SI-server found in known_server_db.
+#===============================================================================
+sub inform_all_other_si_server {
+ my ($msg) = @_;
+
+ # determine all other si-server from known_server_db
+ my $sql_statement= "SELECT * FROM $main::known_server_tn";
+ my $res = $main::known_server_db->select_dbentry( $sql_statement );
+
+ while( my ($hit_num, $hit) = each %$res ) {
+ my $act_target_address = $hit->{hostname};
+ my $act_target_key = $hit->{hostkey};
+
+ # determine the source address corresponding to the actual target address
+ my ($act_target_ip, $act_target_port) = split(/:/, $act_target_address);
+ my $act_source_address = &main::get_local_ip_for_remote_ip($act_target_ip).":$act_target_port";
+
+ # fill into message the correct target and source addresses
+ my $act_msg = $msg;
+ $act_msg =~ s/<target>\w*<\/target>/<target>$act_target_address<\/target>/g;
+ $act_msg =~ s/<source>\w*<\/source>/<source>$act_source_address<\/source>/g;
+
+ # send message to the target
+ &main::send_msg_to_target($act_msg, $act_target_address, $act_target_key, "foreign_job_updates" , "J");
+ }
+
+ return;
+}
+
1;