/[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 190 by dpavlin, Mon Aug 10 00:07:38 2009 UTC revision 194 by dpavlin, Mon Aug 10 17:30:01 2009 UTC
# Line 71  sub next_ip { Line 71  sub next_ip {
71    
72  }  }
73    
74    sub ip_from_mac {
75            my $mac = shift;
76    
77            $mac = lc $mac;
78            $mac =~ s{:}{}g;
79    
80            my $mac_path = "$server::conf/mac/$mac";
81            return unless -e $mac_path;
82    
83            my $ip;
84    
85            if ( -f $mac_path ) {
86                    $ip = read_file $mac_path;
87                    unlink $mac_path;
88                    symlink "$server::conf/ip/$ip", $mac_path;
89                    warn "I: upgrade to mac symlink $mac_path\n";
90            } elsif ( -l $mac_path ) {
91                    $ip = readlink $mac_path;
92                    $ip =~ s{^.+/([^/]+)$}{$1};
93            } else {
94                    die "$mac_path not file or symlink";
95            }
96    
97            return $ip;
98    }
99    
100  1;  1;

Legend:
Removed from v.190  
changed lines
  Added in v.194

  ViewVC Help
Powered by ViewVC 1.1.26