/[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 166 by dpavlin, Thu Aug 6 18:55:51 2009 UTC revision 173 by dpavlin, Thu Aug 6 22:29:58 2009 UTC
# Line 52  use progress_bar; Line 52  use progress_bar;
52  use config;  use config;
53  use client;  use client;
54  use log;  use log;
55    use x11;
56    
57  sub static {  sub static {
58          my ($client,$path) = @_;          my ($client,$path) = @_;
# Line 106  sub static { Line 107  sub static {
107  use boolean;  use boolean;
108    
109  use kvm;  use kvm;
 use qemu; $pids->{qemu} = 'stopped';  
110    
111  $SIG{CHLD} = 'IGNORE';  $SIG{CHLD} = 'IGNORE';
112    
# Line 136  sub start_stop { Line 136  sub start_stop {
136                          if ( $daemon =~ m{dhcpd|tftpd|dnsd} ) {                          if ( $daemon =~ m{dhcpd|tftpd|dnsd} ) {
137                                  my $exec = "perl -I$server::base_dir/lib -I$server::base_dir/lib/PXElator -M$daemon -e ${daemon}::${invoke}";                                  my $exec = "perl -I$server::base_dir/lib -I$server::base_dir/lib/PXElator -M$daemon -e ${daemon}::${invoke}";
138                                  warn "exec $exec";                                  warn "exec $exec";
139                                  exec "xterm -T $daemon -n $daemon -e $exec";                                  x11::xterm( $daemon => $exec );
140                          } else {                          } else {
141                                  my $eval = $daemon . '::' . $invoke . '(' . ( @_ ? dump(@_) : '' ) . ')';                                  my $eval = $daemon . '::' . $invoke . '(' . ( @_ ? dump(@_) : '' ) . ')';
142                                  warn "eval $eval";                                  warn "eval $eval";
# Line 174  sub get_request { Line 174  sub get_request {
174                  foreach my $name ( sort keys %$pids ) {                  foreach my $name ( sort keys %$pids ) {
175                          my $pid = $pids->{$name} || next;                          my $pid = $pids->{$name} || next;
176    
177                          my $html = qq|<a href=/start_stop/$name>$pid</a>|;                          my $html;
178    
179                          my $proc = "/proc/$pid/status";                          my $proc = "/proc/$pid/status";
180    
181                          if ( -e $proc ) {                          if ( -e $proc ) {
182                                    $html .= qq|<a href=/start_stop/$name>$pid</a>|;
183                                  if ( $debug ) {                                  if ( $debug ) {
184                                          $html .= qq| <a name=$pid href=#proc-$pid>?</a>|;                                          $html .= qq| <a name=$pid href=#proc-$pid>?</a>|;
185    
# Line 196  sub get_request { Line 197  sub get_request {
197                                  if ( $name->can('actions') ) {                                  if ( $name->can('actions') ) {
198                                          $html .= qq| <a href=/action/kvm/$_>$_</a>| foreach $name->actions;                                          $html .= qq| <a href=/action/kvm/$_>$_</a>| foreach $name->actions;
199                                  }                                  }
200                            } else {
201                                    $html .= qq|<a href=/start_stop/$name>restart</a> $pid exited|;
202                          }                          }
203    
204                          push @rows, ( $name => $html );                          push @rows, ( $name => $html );
# Line 248  sub get_request { Line 251  sub get_request {
251                  } else {                  } else {
252                          print $client $ok                          print $client $ok
253                                  , qq|<h2>Clients on $server::ip</h2>|                                  , qq|<h2>Clients on $server::ip</h2>|
254                                  , qq|<ul>|                                  , html::table( -4,
255                                  , join("\n",                                          'ip', 'mac', 'hostname', 'deploy',
256                                          map {                                          map {
257                                                  my $ip = $_;                                                  my $ip = $_;
258                                                  $ip =~ s{^.+/ip/}{};                                                  $ip =~ s{^.+/ip/}{};
259                                                  qq|<li><a href=/client/$ip>$ip</a> |, client::mac($ip), ' ', client::conf( $ip, 'hostname' ), qq|</li>|;                                                  ( qq|<a href=/client/$ip>$ip</a>|, client::mac($ip), client::conf( $ip, 'hostname' ), client::conf( $ip, 'deploy' ) );
260                                          }                                          }
261                                          glob("$server::conf/ip/*")                                          glob("$server::conf/ip/*")
262                                  )                                  )
                                 , qq|</ul>|  
263                                  ;                                  ;
264                  }                  }
265          } elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) {          } elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) {

Legend:
Removed from v.166  
changed lines
  Added in v.173

  ViewVC Help
Powered by ViewVC 1.1.26