--- lib/PXElator/html.pm 2009/08/30 10:37:07 361 +++ lib/PXElator/html.pm 2009/09/10 13:57:44 420 @@ -1,6 +1,7 @@ package html; use Data::Dump qw/dump/; +use amt; sub table { my $cols = shift; @@ -50,7 +51,6 @@ , qq|| - , qq|| ); } @@ -70,7 +70,7 @@ my ($ip,$conf,$format) = @_; my @editable = splice(@_,3); - warn "# conf ",dump( $ip, $conf, $format, [ @editable ] ); +# warn "# conf ",dump( $ip, $conf, $format, [ @editable ] ); $format ||= 'inline'; @@ -83,22 +83,35 @@ ( $name, qq|| ) } else { if ( $name eq 'amt' ) { - $html = qq|logon|; + my $amt_ip = amt::ip($ip,$html); + $html = qq|$amt_ip|; + + if ( $format ne 'inline' ) { + my $power = amt::power_on($ip); + $html .= qq| power: | + . ( $power + ? qq|on| + : qq|off| + ); + client::conf( $ip, 'power' => $power ? 'on' : 'off' ); + } } elsif ( $name eq 'ssh' ) { $html =~ s{\s(\S{16}).+(\S{16})\s}{ $1..$2 }; chomp($html); + } elsif ( $name eq 'kvm' ) { + $html = qq|$html|; } - $html = qq|
$html
| + $html = qq|$html| unless $html =~ s{\b(\S+)\t(\S+)\t(\S+)\b}{$3 }gs; if ( $format =~ /edit|table/ ) { ( $name, $html ); } else { - qq|$name $html
| + qq|
$name $html
| } } - } keys %$conf; + } grep { length($conf->{$_}) > 0 } sort keys %$conf; $format eq 'inline' ? join("\n", @opts) : @opts; }