--- lib/PXElator/client.pm 2009/08/17 13:27:18 244 +++ lib/PXElator/client.pm 2009/08/27 14:30:55 305 @@ -66,6 +66,17 @@ return $value; } +sub all_conf { + my $ip = shift; + my $path = ip_path $ip || return; + my $conf; + foreach my $file ( glob("$path/*") ) { + my $name = $file; + $name =~ s{^.+/([^/]+)$}{$1}; + $conf->{ $name } = read_file $file; + } + return $conf; +} sub next_ip($) { my $mac = shift; @@ -92,10 +103,10 @@ sub save_ip_mac { my ($ip,$mac) = @_; - mkdir ip_path($ip); + mkdir ip_path($ip) unless -e ip_path($ip); my $mac_path = mac_path($mac); - unlink $mac_path if -e $mac_path; # XXX audit? + unlink $mac_path if -l $mac_path; # XXX audit? symlink ip_path($ip), $mac_path; write_file ip_path($ip,'mac'), $mac; }