/[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 243 by dpavlin, Sat Aug 15 13:47:37 2009 UTC revision 244 by dpavlin, Mon Aug 17 13:27:18 2009 UTC
# Line 6  use autodie; Line 6  use autodie;
6    
7  use File::Slurp;  use File::Slurp;
8  use Net::Ping;  use Net::Ping;
 use Carp qw/confess/;  
9    
10  use server;  use server;
11  use format;  use format;
# Line 31  sub conf_value { Line 30  sub conf_value {
30          } elsif ( -f $path ) {          } elsif ( -f $path ) {
31                  $value = read_file $path;                  $value = read_file $path;
32          } else {          } else {
33                  confess "$path not file or symlink";                  warn "W: $path not file or symlink\n";
34          }          }
35          return $value;          return $value;
36  }  }
# Line 85  sub next_ip($) { Line 84  sub next_ip($) {
84    
85          warn "next_ip $ip\n";          warn "next_ip $ip\n";
86    
87            save_ip_mac( $ip, $mac );
88    
89            return $ip;
90    }
91    
92    sub save_ip_mac {
93            my ($ip,$mac) = @_;
94    
95          mkdir ip_path($ip);          mkdir ip_path($ip);
96    
97          my $mac_path = mac_path($mac);          my $mac_path = mac_path($mac);
98          unlink $mac_path if -e $mac_path;       # XXX audit?          unlink $mac_path if -e $mac_path;       # XXX audit?
99          symlink ip_path($ip), $mac_path;          symlink ip_path($ip), $mac_path;
100          write_file ip_path($ip,'mac'), $mac;          write_file ip_path($ip,'mac'), $mac;
   
         return $ip;  
   
101  }  }
102    
103  sub ip_from_mac($) {  sub ip_from_mac($) {

Legend:
Removed from v.243  
changed lines
  Added in v.244

  ViewVC Help
Powered by ViewVC 1.1.26