From 90f776d38c1d42e57b249677d641711790c58d39 Mon Sep 17 00:00:00 2001 From: janw Date: Wed, 20 Feb 2008 14:19:17 +0000 Subject: [PATCH] Fixed gosaUnitTag creation. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8993 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 3 ++- gosa-si/modules/SIPackages.pm | 18 ++++++++---------- gosa-si/server/events/siTriggered.pm | 6 ++---- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index a182873d3..0902420ed 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -59,7 +59,7 @@ my ($xml); # variables declared in config file are always set to 'our' our (%cfg_defaults, $log_file, $pid_file, $server_ip, $server_port, $SIPackages_key, - $arp_activ, + $arp_activ, $gosa_unit_tag, $GosaPackages_key, $gosa_ip, $gosa_port, $gosa_timeout, ); @@ -111,6 +111,7 @@ our $prg= basename($0); "port" => [\$server_port, "20081"], "known-clients" => [\$known_clients_file_name, '/var/lib/gosa-si/clients.db' ], "known-servers" => [\$known_server_file_name, '/var/lib/gosa-si/servers.db'], + "gosa-unit-tag" => [\$gosa_unit_tag, ""], }, "GOsaPackages" => { "ip" => [\$gosa_ip, "0.0.0.0"], diff --git a/gosa-si/modules/SIPackages.pm b/gosa-si/modules/SIPackages.pm index 3250fb1cf..3d74d38b6 100644 --- a/gosa-si/modules/SIPackages.pm +++ b/gosa-si/modules/SIPackages.pm @@ -30,8 +30,7 @@ my $server; my $event_hash; my $network_interface; my $no_bus; -my (@ldap_cfg, @pam_cfg, @nss_cfg, $goto_admin, $goto_secret, $gosa_unit_tag); - +my (@ldap_cfg, @pam_cfg, @nss_cfg, $goto_admin, $goto_secret); my %cfg_defaults = ( "bus" => { @@ -49,7 +48,6 @@ my %cfg_defaults = ( "ldap-admin-dn" => [\$ldap_admin_dn, ""], "ldap-admin-password" => [\$ldap_admin_password, ""], "max-clients" => [\$max_clients, 100], - "gosa-unit-tag" => [\$gosa_unit_tag, ""], }, "SIPackages" => { "key" => [\$SIPackages_key, ""], @@ -67,7 +65,7 @@ $server_mac_address= &get_mac($network_interface); &import_events(); # Unit tag can be defined in config -if((not defined($gosa_unit_tag)) || length($gosa_unit_tag) == 0) { +if((not defined($main::gosa_unit_tag)) || length($main::gosa_unit_tag) == 0) { # Read gosaUnitTag from LDAP my $tmp_ldap= Net::LDAP->new($ldap_uri); if(defined($tmp_ldap)) { @@ -86,7 +84,7 @@ if((not defined($gosa_unit_tag)) || length($gosa_unit_tag) == 0) { my $unit_tag= $entry->get_value("gosaUnitTag"); if(defined($unit_tag) && length($unit_tag) > 0) { &main::daemon_log("Detected gosaUnitTag $unit_tag for creating entries", 4); - $gosa_unit_tag= $unit_tag; + $main::gosa_unit_tag= $unit_tag; } } else { # Perform another search for Unit Tag @@ -104,7 +102,7 @@ if((not defined($gosa_unit_tag)) || length($gosa_unit_tag) == 0) { my $unit_tag= $entry->get_value("gosaUnitTag"); if(defined($unit_tag) && length($unit_tag) > 0) { &main::daemon_log("Detected gosaUnitTag $unit_tag for creating entries", 4); - $gosa_unit_tag= $unit_tag; + $main::gosa_unit_tag= $unit_tag; } } else { # Perform another search for Unit Tag @@ -122,7 +120,7 @@ if((not defined($gosa_unit_tag)) || length($gosa_unit_tag) == 0) { my $unit_tag= $entry->get_value("gosaUnitTag"); if(defined($unit_tag) && length($unit_tag) > 0) { &main::daemon_log("Detected gosaUnitTag $unit_tag for creating entries", 4); - $gosa_unit_tag= $unit_tag; + $main::gosa_unit_tag= $unit_tag; } } else { &main::daemon_log("Not using gosaUnitTag", 6); @@ -130,7 +128,7 @@ if((not defined($gosa_unit_tag)) || length($gosa_unit_tag) == 0) { } } } else { - &main::daemon_log("Using gosaUnitTag from config-file: $gosa_unit_tag",6); + &main::daemon_log("Using gosaUnitTag from config-file: $main::gosa_unit_tag",6); } $tmp_ldap->unbind; } @@ -951,9 +949,9 @@ sub new_ldap_config { # $entry->add("gotomode" => "locked"); # $entry->add("gotoSysStatus" => "new-system"); # $entry->add("ipHostNumber" => $ipaddress); -# if(defined($gosa_unit_tag) && length($gosa_unit_tag) > 0) { +# if(defined($main::gosa_unit_tag) && length($main::gosa_unit_tag) > 0) { # $entry->add("objectClass" => "gosaAdministrativeUnit"); -# $entry->add("gosaUnitTag" => $gosa_unit_tag); +# $entry->add("gosaUnitTag" => $main::gosa_unit_tag); # } # my $res=$entry->update($ldap); # if(defined($res->{'errorMessage'}) && diff --git a/gosa-si/server/events/siTriggered.pm b/gosa-si/server/events/siTriggered.pm index 88cc39f1b..92f7670f0 100644 --- a/gosa-si/server/events/siTriggered.pm +++ b/gosa-si/server/events/siTriggered.pm @@ -24,7 +24,6 @@ my $ldap_uri; my $ldap_base; my $ldap_admin_dn; my $ldap_admin_password; -my $gosa_unit_tag; my %cfg_defaults = ( "server" => { @@ -32,7 +31,6 @@ my %cfg_defaults = ( "ldap-base" => [\$ldap_base, ""], "ldap-admin-dn" => [\$ldap_admin_dn, ""], "ldap-admin-password" => [\$ldap_admin_password, ""], - "gosa-unit-tag" => [\$gosa_unit_tag, ""], }, ); &read_configfile($main::cfg_file, %cfg_defaults); @@ -163,9 +161,9 @@ sub detected_hardware { $entry->add("gotomode" => "locked"); $entry->add("gotoSysStatus" => "new-system"); $entry->add("ipHostNumber" => $ipaddress); - if(defined($gosa_unit_tag) && length($gosa_unit_tag) > 0) { + if(defined($main::gosa_unit_tag) && length($main::gosa_unit_tag) > 0) { $entry->add("objectClass" => "gosaAdministrativeUnit"); - $entry->add("gosaUnitTag" => $gosa_unit_tag); + $entry->add("gosaUnitTag" => $main::gosa_unit_tag); } my $res=$entry->update($ldap); if(defined($res->{'errorMessage'}) && -- 2.30.2