Code

Updated Recipies tab for servers and workstations.
[gosa.git] / gosa-si / modules / ClientPackages.pm
index 8fc6318bcf69b87dfd021adf2558e858c0eed3e4..ad94ee2f0e3d45918a1dd7a4b844efde95bc0adf 100644 (file)
@@ -5,8 +5,6 @@ package ClientPackages;
 use strict;
 use warnings;
 
-use Exporter;
-use GOSA::GosaSupportDaemon;
 use IO::Socket::INET;
 use XML::Simple;
 use Data::Dumper;
@@ -15,8 +13,11 @@ use Net::LDAP;
 use Net::LDAP::Util;
 use Socket;
 use Net::hostent;
+use GOsaSI::GosaSupportDaemon;
+
+use Exporter;
 
-@ISA = ("Exporter");
+our @ISA = ("Exporter");
 
 my $event_dir = "/usr/lib/gosa-si/server/ClientPackages";
 use lib "/usr/lib/gosa-si/server/ClientPackages";
@@ -31,7 +32,7 @@ my (@ldap_cfg, @pam_cfg, @nss_cfg, $goto_admin, $goto_secret);
 my $mesg;
 
 my %cfg_defaults = (
-"server" => {
+"Server" => {
     "ip" => [\$server_ip, "0.0.0.0"],
     "mac-address" => [\$main::server_mac_address, "00:00:00:00:00"],
     "port" => [\$server_port, "20081"],
@@ -49,6 +50,7 @@ my %cfg_defaults = (
 ### START #####################################################################
 
 # read configfile and import variables
+#why not using the main::read_configfile !!
 &local_read_configfile();
 
 
@@ -452,7 +454,7 @@ sub here_i_am {
     if ( defined($msg_hash->{'force-hostname'}[0]) &&
        length($msg_hash->{'force-hostname'}[0]) > 0){
     #      $heap->{force-hostname}->{$mac_address}= $msg_hash->{'force-hostname'}[0];
-           open ($TFILE, ">", "/var/tmp/$mac_address");
+           open (my $TFILE, ">", "/var/tmp/$mac_address");
            print $TFILE $msg_hash->{'force-hostname'}[0];
            close ($TFILE); 
     } else {
@@ -564,7 +566,7 @@ sub here_i_am {
     if($ldap_res->code) {
             &main::daemon_log("$session_id ERROR: LDAP Entry for client with mac address $mac_address not found: ".$ldap_res->error, 1);
     } elsif ($ldap_res->count != 1) {
-            &main::daemon_log("$session_id ERROR: client with mac address $mac_address not found/unique/active - not updating ldap entry".
+            &main::daemon_log("$session_id WARNING: client with mac address $mac_address not found/unique/active - not updating ldap entry".
                             "\n\tbase: $ldap_base".
                             "\n\tscope: sub".
                             "\n\tattrs: ipHostNumber".
@@ -664,7 +666,7 @@ sub new_syslog_config {
 
        # Sanity check
        if ($ldap_res->count != 1) {
-               &main::daemon_log("$session_id ERROR: client with mac address $mac_address not found/unique/active - not sending syslog config".
+               &main::daemon_log("$session_id WARNING: client with mac address $mac_address not found/unique/active - not sending syslog config".
                 "\n\tbase: $ldap_base".
                 "\n\tscope: sub".
                 "\n\tattrs: gotoSyslogServer".
@@ -880,7 +882,7 @@ sub new_ldap_config {
 
                # Sanity check
         if ($mesg->count != 1) {
-            &main::daemon_log("$session_id ERROR: new_ldap_config: client with mac address $macaddress not found/unique/active - not sending ldap config".
+            &main::daemon_log("$session_id WARNING: new_ldap_config: client with mac address $macaddress not found/unique/active - not sending ldap config".
                     "\n\tbase: $ldap_base".
                     "\n\tscope: sub".
                     "\n\tattrs: dn, gotoLdapServer, FAIclass".
@@ -1082,7 +1084,7 @@ sub server_matches {
                } else {
                        my $PROC_NET_ROUTE= ('/proc/net/route');
 
-                       open($FD_PROC_NET_ROUTE, "<", "$PROC_NET_ROUTE")
+                       open(my $FD_PROC_NET_ROUTE, "<", "$PROC_NET_ROUTE")
                                or die "Could not open $PROC_NET_ROUTE";
 
                        my @ifs = <$FD_PROC_NET_ROUTE>;