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

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

revision 208 by dpavlin, Wed Aug 12 23:59:01 2009 UTC revision 224 by dpavlin, Sat Aug 15 22:38:02 2009 UTC
# Line 24  sub menu {qq{ Line 24  sub menu {qq{
24  <div style="font-size: 80%; color: #888">  <div style="font-size: 80%; color: #888">
25  <a href=/>home</a>  <a href=/>home</a>
26  <a href=/server>server</a>  <a href=/server>server</a>
27    <a href=/ip>ip</a>
28  <a href=/client>client</a>  <a href=/client>client</a>
29  </div>  </div>
30    
# Line 49  use daemons; Line 50  use daemons;
50  use kvm;  use kvm;
51  use browser;  use browser;
52  use network;  use network;
53    use ip;
54    
55  use CouchDB;  use CouchDB;
56    
# Line 203  sub get_request { Line 205  sub get_request {
205    
206                          my $deploy;                          my $deploy;
207    
208                          if ( my $mac = client::mac( $ip ) ) {                          if ( my $mac = client::mac_from_ip( $ip ) ) {
209                                  $deploy = client::conf( $ip, 'deploy' => $param->{deploy} );                                  $deploy = client::conf( $ip, 'deploy' => $param->{deploy} );
210                                  push @table, (                                  push @table, (
211                                          'mac' => $mac,                                          'mac' => format::mac( $mac => 'html' ),
212                                          'deploy' => html::select( 'deploy', $deploy, config::available )                                          'deploy' => html::select( 'deploy', $deploy, config::available )
213                                  );                                  );
214                                  $deploy = qq|<h2>PXElinux</h2>| . html::pre( config::for_ip( $ip ) );                                  $deploy = qq|<h2>PXElinux</h2>| . html::pre( config::for_ip( $ip ) );
# Line 243  sub get_request { Line 245  sub get_request {
245                                          map {                                          map {
246                                                  my $ip = $_;                                                  my $ip = $_;
247                                                  $ip =~ s{^.+/ip/}{};                                                  $ip =~ s{^.+/ip/}{};
248                                                  my $arp = $arp->{ client::mac $ip, 'clean' };                                                  my $mac = client::mac_from_ip $ip;
249                                                    my $arp = $arp->{ $mac };
250                                                  $arp = $arp ? $arp->[1] : '';                                                  $arp = $arp ? $arp->[1] : '';
251                                                  $arp =~ s{$ip}{};                                                  $arp =~ s{$ip}{};
252                                                  (                                                  (
253                                                          qq|<a href=/client/$ip>$ip</a>|                                                          qq|<a href=/client/$ip>$ip</a>|
254                                                          , client::conf( $ip, 'hostname' )                                                          , client::conf( $ip, 'hostname' )
255                                                          , client::mac( $ip )                                                          , format::mac( $mac => 'html' )
256                                                          , html::tt( client::conf( $ip, 'deploy' ) )                                                          , html::tt( client::conf( $ip, 'deploy' ) )
257                                                          , $arp                                                          , $arp
258                                                  );                                                  );
# Line 260  sub get_request { Line 263  sub get_request {
263                                  , html::table( -3, 'mac', 'dev', 'ip',                                  , html::table( -3, 'mac', 'dev', 'ip',
264                                          map {                                          map {
265                                                  my $c = $arp->{$_};                                                  my $c = $arp->{$_};
266                                                  ( html::tt( $_ ), $c->[1], $c->[0] )                                                  ( format::mac( $_ => 'html' ), $c->[1], $c->[0] )
267                                          } sort keys %$arp                                          } sort keys %$arp
268                                  )                                  )
269                                  ;                                  ;
270                  }                  }
271            } elsif ( $path =~ m{^/ip/?(\w+)?} ) {
272                    print $client ok
273                            , join("\n", map { qq|<a href=/ip/$_>$_</a>| } ( qw/link addr route neigh ntable tunnel maddr mroute xfrm/ ))
274                            , ip::html( $1 )
275                            ;
276          } elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) {          } elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) {
277                  eval 'our $' . $1 . ' = ' . $2;                  eval 'our $' . $1 . ' = ' . $2;
278                  warn $@ if $@;                  warn $@ if $@;

Legend:
Removed from v.208  
changed lines
  Added in v.224

  ViewVC Help
Powered by ViewVC 1.1.26