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

Contents of /lib/PXElator/amt.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 336 - (show annotations)
Sat Aug 29 00:07:00 2009 UTC (14 years, 7 months ago) by dpavlin
File size: 995 byte(s)
just warn about unreachable clients, but wrap our soap invocation in eval
1 package amt;
2
3 use warnings;
4 use strict;
5
6 use lib '/srv/Intel-AMT/lib/';
7 use Intel::AMT::RemoteControl;
8 use Intel::AMT::NetworkAdministration;
9 use Data::Dump qw/dump/;
10 use Regexp::Common qw/net/;
11
12 use html;
13 use ping;
14 use CouchDB;
15
16 sub info {
17 my ( $amt, $client_ip ) = @_;
18 my ( $passwd, $ip ) = split(/\s+/, $amt);
19 ( $ip, $passwd ) = ( $passwd, $ip ) if $passwd =~ m/$RE{net}{IPv4}/;
20
21 $ip ||= $client_ip;
22
23 if ( ! ping::host( $ip ) ) {
24 warn "$ip unreachable";
25 }
26
27 warn "amt $ip ", '*' x length($passwd), "\n";
28
29 $ENV{AMT_HOST} = $ip;
30 $ENV{AMT_PASSWORD} = $passwd;
31
32 my $amt;
33 eval {
34 $amt = Intel::AMT::NetworkAdministration::network_settings;
35 $amt->{power_state} = Intel::AMT::RemoteControl::SystemPowerState;
36 CouchDB::audit('network', $amt );
37 };
38 warn "ERROR amt $@" if $@;
39
40 my $out;
41
42 $out =
43 qq| <a href="http://$ip:16992/" target="$ip">amt</a>|
44 . qq| <a href="http://$ip:16992/ip.htm" target="$ip">ip</a>|
45 . qq|<br>|
46 . html::pre_dump( $amt )
47 ;
48
49 return $out;
50 }
51
52 1;

  ViewVC Help
Powered by ViewVC 1.1.26