/[pxelator]/lib/PXElator/server.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/server.pm

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

revision 134 by dpavlin, Tue Aug 4 13:18:36 2009 UTC revision 153 by dpavlin, Wed Aug 5 23:22:17 2009 UTC
# Line 3  package server; Line 3  package server;
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
 use Module::Refresh qw//;  
 sub x_refresh { Module::Refresh->refresh };  
6    
7  our $ip      = '172.16.10.1';  our $ip      = '172.16.10.1';
8  our $netmask = '255.255.255.0';  our $netmask = '255.255.255.0';
9    
10  our ( $ip_from, $ip_to ) = ( 10, 100 );  our ( $ip_from, $ip_to ) = ( 10, 100 );
11    
12    our $domain_name = 'pxelator.lan';
13    
14  our $base_dir = '/srv/pxelator';  our $base_dir = '/srv/pxelator';
15    
16  use config;  use Module::Refresh qw//;
17    sub refresh { Module::Refresh->refresh };
18    
19    mkdir $_ foreach grep { ! -e $_ } map { "$base_dir/conf/$server::ip/$_" } ( 'ip', 'mac', 'hostname', 'deploy' );
20    
21    use File::Slurp;
22    sub shared {
23            my ($name, $value) = @_;
24    
25            my $path ="$base_dir/conf/$server::ip/$name";
26            if ( defined $value ) {
27                    write_file $path, $value;
28                    warn "update $path = $value";
29            } else {
30                    $value = read_file $path if -e $path;
31            }
32            return $value;
33    }
34    
35  our $debug;  sub debug { shared('debug', @_) || 0 }
 sub debug { $debug = config::shared('debug', @_) || 0 }  
36    
37  warn "loaded";  warn "loaded";
38    

Legend:
Removed from v.134  
changed lines
  Added in v.153

  ViewVC Help
Powered by ViewVC 1.1.26