--- lib/PXElator/client.pm 2009/09/09 13:40:45 412 +++ lib/PXElator/client.pm 2010/01/02 15:47:39 455 @@ -64,6 +64,7 @@ $value = $default; } elsif ( -f $path ) { $value = read_file $path; + chomp $value; } else { warn "# $name missing $path\n" if $debug; } @@ -74,10 +75,10 @@ my $ip = shift; my $path = ip_path $ip || return; my $conf; - foreach my $file ( glob("$path/*") ) { + foreach my $file ( glob("$path/*"), glob("$path/*/*") ) { my $name = $file; - $name =~ s{^.+/([^/]+)$}{$1}; - $conf->{ $name } = read_file $file; + $name =~ s{^$path/+}{} || die "can't remove $path from $name"; + $conf->{ $name } = read_file $file if -f $file; } return $conf; } @@ -173,7 +174,6 @@ sub remove { my $ip = shift; - unlink $_ foreach grep { -e $_ } ( glob "$server::conf/ip/$ip/*" ); if ( my $mac = mac_from_ip $ip ) { unlink "$server::conf/mac/$mac"; } @@ -202,6 +202,7 @@ my $mac = ip_path $ip, 'mac'; if ( -e $mac ) { $mac = read_file $mac; + chomp $mac; save_ip_mac( $ip, $mac ); warn "## $ip $mac\n"; }