summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36d6bda)
raw | patch | inline | side by side (parent: 36d6bda)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 16 Jan 2008 16:08:06 +0000 (16:08 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 16 Jan 2008 16:08:06 +0000 (16:08 +0000) |
workaround: all empty hashes in a xml_content are substituted with "none"
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8402 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8402 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history | |
gosa-si/modules/GosaSupportDaemon.pm | patch | blob | history | |
gosa-si/modules/ServerPackages.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 2e9fc52d79663b0cc40bfe2daeaa14633ce1b0b8..69a5f7ffd9049791a2a1c31fe8e09ab5f077cfdb 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
my (@events);
# default variables
-my $event_dir = "/etc/gosa-si/client/events";
+my $event_dir = "/usr/lib/gosa-si/client/events";
$known_hosts = {};
$foreground = 0 ;
%cfg_defaults =
opendir(DIR, $event_dir)
or daemon_log("cannot find directory $event_dir!\ngosa-si-client starts without any accepting events!", 1);
my $file_name;
- @events = ();
+ my @events_list = ();
while(defined($file_name = readdir(DIR))){
if ($file_name eq "." || $file_name eq "..") {
next;
}
- push(@events, $file_name);
+ push(@events_list, $file_name);
}
- my $events = join(",", @events);
+ my $events = join(",", @events_list);
daemon_log("found events: $events", 1);
# fill in all possible servers
my ($rout, $wout, $reg_server);
foreach my $server (@servers) {
-# TODO : server abhängige macadress und ipadresse eintragen
-
# create msg hash
my $register_hash = &create_xml_hash("here_i_am", $client_address, $server);
&add_content2xml_hash($register_hash, "new_passwd", $new_server_passwd);
&add_content2xml_hash($register_hash, "mac_address", $client_mac_address);
&add_content2xml_hash($register_hash, "events", $events);
+ my $tmp = print Dumper $register_hash;
+
# send xml hash to server with general server passwd
my $answer = &send_msg_hash2address($register_hash, $server, $server_passwd);
index 002308e537d574d997c2268e4eeaea10f99f5e31..cf26ca49fc88e24b5b22e622bea255cd86e33585 100644 (file)
sub transform_msg2hash {
my ($msg) = @_ ;
my $hash = $xml->XMLin($msg, ForceArray=>1);
+
+ # xml tags without a content are created as an empty hash
+ # substitute it with an empty list
+ while( my ($xml_tag, $xml_content) = each %{ $hash } ) {
+ if( 1 == @{ $xml_content } ) {
+ # there is only one element in xml_content list ...
+ my $element = @{ $xml_content }[0];
+ if( ref($element) eq "HASH" ) {
+ # and this element is an hash ...
+ my $len_element = keys %{ $element };
+ if( $len_element == 0 ) {
+ # and this hash is empty, then substitute the xml_content
+ # with an empty string in list
+ $hash->{$xml_tag} = [ "none" ];
+ }
+ }
+ }
+ }
+
return $hash;
}
index 80b34bb165178420f6cee4cbbf40c8c4b94b0573..350619f840a7359acc57eb982b0a2c66f0f021ad 100644 (file)
my $header = @{$msg_hash->{header}}[0];
my $source = @{$msg_hash->{source}}[0];
- &main::daemon_log("receive '$header' at ServerPackages from $host", 1);
+ &main::daemon_log("recieve '$header' at ServerPackages from $host", 1);
&main::daemon_log("ServerPackages: msg to process: \n$msg", 7);
my @targets = @{$msg_hash->{target}};