Code

Fixed gosaUnitTag creation.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Feb 2008 14:19:17 +0000 (14:19 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 20 Feb 2008 14:19:17 +0000 (14:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8993 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server
gosa-si/modules/SIPackages.pm
gosa-si/server/events/siTriggered.pm

index a182873d38b6dd7b3d5d9f15d1a9c02a7a55be36..0902420ed9fcf0d9e0f3f7023e8db43df6dc2758 100755 (executable)
@@ -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"],
index 3250fb1cf12f6ac376dc2939ae08c04a47a2cae3..3d74d38b62dc57cef885b3aced89b2d9b5cb9f2c 100644 (file)
@@ -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'}) &&
index 88cc39f1b1ce1605278dc00fa9a64140aa6a9ce8..92f7670f0f22a7c427ba906497060fa368df6b3f 100644 (file)
@@ -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'}) &&