/[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 81 by dpavlin, Fri Jul 31 16:47:52 2009 UTC revision 91 by dpavlin, Fri Jul 31 18:48:29 2009 UTC
# Line 150  sub get_request { Line 150  sub get_request {
150                  my $debug_proc;                  my $debug_proc;
151    
152                  warn 'pids: ', dump( $pids ) if $debug;                  warn 'pids: ', dump( $pids ) if $debug;
153                  foreach my $name ( keys %$pids ) {                  foreach my $name ( sort keys %$pids ) {
154                          my $pid = $pids->{$name} || next;                          my $pid = $pids->{$name} || next;
155    
156                          my $html = qq|<a href=/$name>$pid</a>|;                          my $html = qq|<a href=/start_stop/$name>$pid</a>|;
157    
158                          my $proc = "/proc/$pid/status";                          my $proc = "/proc/$pid/status";
159    
# Line 168  sub get_request { Line 168  sub get_request {
168                                                  ;                                                  ;
169                                  }                                  }
170    
171                                  if ( $name->can('start_options') ) {                                  if ( $name->can('start_fork') ) {
172                                          $html .= qq| <a href=/kvm/$_>$_</a>| foreach $name->start_options;                                          $html .= qq| <a href=/start_stop/kvm/$_>$_</a>| foreach $name->start_fork;
173                                    }
174    
175                                    if ( $name->can('actions') ) {
176                                            $html .= qq| <a href=/action/kvm/$_>$_</a>| foreach $name->actions;
177                                  }                                  }
178                          }                          }
179    
180                          push @rows, ( $name => $html );                          push @rows, ( $name => $html );
181                  }                  }
182    
183                    my $below_table = '';
184    
185                  warn 'static_pids: ', dump( $static_pids ) if $debug;                  warn 'static_pids: ', dump( $static_pids ) if $debug;
186                  foreach my $pid ( keys %$static_pids ) {                  foreach my $pid ( keys %$static_pids ) {
187                          my $path = $static_pids->{$pid};                          my $path = $static_pids->{$pid};
188                          if ( -d "/proc/$pid" ) {                          if ( -d "/proc/$pid" ) {
189                                  push @rows, ( $path => qq|<a href=/kill/static/$pid>$pid</a>| );                                  push @rows, ( $path => qq|<a href=/kill/static/$pid>$pid</a>| );
190                            } elsif ( $param->{clean_completed_downloads} ) {
191                                    delete $static_pids->{$pid}
192                          } else {                          } else {
193                                  push @rows, ( $path => "$pid competed" );                                  push @rows, ( $path => "$pid competed" );
194                                    $below_table = qq|<a href="/?clean_completed_downloads=1">clean completed downloads</a>|;
195                          }                          }
196                  }                  }
197    
198                  print $client $ok                  print $client $ok
199                          , html::table( 2, @rows )                          , html::table( 2, @rows )
200                            , $below_table
201                          , html::tabs( log::mac_changes )                          , html::tabs( log::mac_changes )
202                          , $debug_proc                          , $debug_proc
203                          ;                          ;
# Line 197  sub get_request { Line 207  sub get_request {
207                  warn $@ if $@;                  warn $@ if $@;
208                  print $client $redirect, qq|<big>$1 = $2</big><br>Location: <a href="$url">$url</a>|;                  print $client $redirect, qq|<big>$1 = $2</big><br>Location: <a href="$url">$url</a>|;
209                  server::debug( $debug ) if $1 eq 'debug';                  server::debug( $debug ) if $1 eq 'debug';
210          } elsif ( $path =~ m{^/((?:screen|kvm).*)} ) {          } elsif ( $path =~ m{^/start_stop/((?:screen|kvm).*)} ) { # XXX we don't want to stop all classes
211                  print $client $redirect, start_stop($1);                  print $client $redirect, start_stop($1);
212            } elsif ( $path =~ m{^/action/([^/]+)/(.+)} ) {
213                    $1->$2();
214                    print $client $redirect;
215          } elsif ( $path =~ m{^/kill/static/(\d+)} ) {          } elsif ( $path =~ m{^/kill/static/(\d+)} ) {
216                  print $client $redirect;                  print $client $redirect;
217                  kill 9, $1 && warn "killed $1";                  kill 1, $1 || kill 9, $2 && warn "killed $1";
218          } elsif ( $path eq '/exit' ) {          } elsif ( $path eq '/exit' ) {
219  #               DESTROY;  #               DESTROY;
220                  exit 0;                  exit 0;

Legend:
Removed from v.81  
changed lines
  Added in v.91

  ViewVC Help
Powered by ViewVC 1.1.26