/[pxelator]/lib/PXElator/client.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/client.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 442 by dpavlin, Wed Sep 9 13:40:45 2009 UTC revision 443 by dpavlin, Tue Sep 29 19:28:24 2009 UTC
# Line 64  sub conf { Line 64  sub conf {
64                  $value = $default;                  $value = $default;
65          } elsif ( -f $path ) {          } elsif ( -f $path ) {
66                  $value = read_file $path;                  $value = read_file $path;
67                    chomp $value;
68          } else {          } else {
69                  warn "# $name missing $path\n" if $debug;                  warn "# $name missing $path\n" if $debug;
70          }          }
# Line 74  sub all_conf { Line 75  sub all_conf {
75          my $ip = shift;          my $ip = shift;
76          my $path = ip_path $ip || return;          my $path = ip_path $ip || return;
77          my $conf;          my $conf;
78          foreach my $file ( glob("$path/*") ) {          foreach my $file ( glob("$path/*"), glob("$path/*/*") ) {
79                  my $name = $file;                  my $name = $file;
80                  $name =~ s{^.+/([^/]+)$}{$1};                  $name =~ s{^$path/+}{} || die "can't remove $path from $name";
81                  $conf->{ $name } = read_file $file;                  $conf->{ $name } = read_file $file if -f $file;
82          }          }
83          return $conf;          return $conf;
84  }  }
# Line 173  sub all_ips { Line 174  sub all_ips {
174    
175  sub remove {  sub remove {
176          my $ip = shift;          my $ip = shift;
         unlink $_ foreach grep { -e $_ } ( glob "$server::conf/ip/$ip/*" );  
177          if ( my $mac = mac_from_ip $ip ) {          if ( my $mac = mac_from_ip $ip ) {
178                  unlink "$server::conf/mac/$mac";                  unlink "$server::conf/mac/$mac";
179          }          }

Legend:
Removed from v.442  
changed lines
  Added in v.443

  ViewVC Help
Powered by ViewVC 1.1.26