summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@ka-ata-killa.panaceas.james.local>2021-09-01 00:15:20 +0100
committerroot <root@ka-ata-killa.panaceas.james.local>2021-09-01 00:15:20 +0100
commitffd666e52164d06bc67d3d134ae8f53eb268bf6b (patch)
tree8ac3fbd546ed67b8053d27e16e8b2e83137473a0
parent21a57211e96a5ce5989ca006af8f26ffe391e0c9 (diff)
downloadinf-ffd666e52164d06bc67d3d134ae8f53eb268bf6b.zip
inf-ffd666e52164d06bc67d3d134ae8f53eb268bf6b.tar.gz
inf-ffd666e52164d06bc67d3d134ae8f53eb268bf6b.tar.bz2
tidy
-rw-r--r--INF.pm24
-rw-r--r--INF/ASRock.pm35
-rw-r--r--INF/DSRx020.pm54
-rw-r--r--INF/ILO.pm5
-rw-r--r--INF/ILO2.pm3
-rw-r--r--INF/ILO5.pm29
6 files changed, 75 insertions, 75 deletions
diff --git a/INF.pm b/INF.pm
index 9b03767..47e381e 100644
--- a/INF.pm
+++ b/INF.pm
@@ -2,13 +2,12 @@ package INF;
use INF::APC;
use INF::DSRx020;
use INF::ILO2;
-use INF::ILO; #ilo 4 confusingly
+use INF::ILO; #ilo 4 confusingly
use INF::ILO5;
use INF::SuperMicro;
use INF::ASRock;
use INF::Cyclades;
-
#$infs = [
# {
# host => 'ms2.foo.com',
@@ -35,19 +34,26 @@ sub new ($;$) {
}
elsif ( $inf->{inf_type} eq 'apc' ) {
return INF::APC->new($inf);
- } elsif ( $inf->{inf_type} eq 'supermicro' ) {
+ }
+ elsif ( $inf->{inf_type} eq 'supermicro' ) {
return INF::SuperMicro->new($inf);
- } elsif ( $inf->{inf_type} eq 'asrock' ) {
+ }
+ elsif ( $inf->{inf_type} eq 'asrock' ) {
return INF::ASRock->new($inf);
- } elsif ( $inf->{inf_type} eq 'ilo2' ) {
+ }
+ elsif ( $inf->{inf_type} eq 'ilo2' ) {
return INF::ILO2->new($inf);
- } elsif ( $inf->{inf_type} eq 'ilo' ) {
+ }
+ elsif ( $inf->{inf_type} eq 'ilo' ) {
return INF::ILO->new($inf);
- } elsif ( $inf->{inf_type} eq 'ilo4' ) {
+ }
+ elsif ( $inf->{inf_type} eq 'ilo4' ) {
return INF::ILO->new($inf);
- } elsif ( $inf->{inf_type} eq 'ilo5' ) {
+ }
+ elsif ( $inf->{inf_type} eq 'ilo5' ) {
return INF::ILO5->new($inf);
- } elsif ( $inf->{inf_type} eq 'cyclades' ) {
+ }
+ elsif ( $inf->{inf_type} eq 'cyclades' ) {
return INF::Cyclades->new($inf);
}
else {
diff --git a/INF/ASRock.pm b/INF/ASRock.pm
index d4449c0..9ae247f 100644
--- a/INF/ASRock.pm
+++ b/INF/ASRock.pm
@@ -39,14 +39,13 @@ sub login($) {
return -1;
}
-
$self->{logged_in} = 1;
my $json = decode_json( $res->content );
$self->{csrftoken} = $json->{CSRFToken};
- print "csrftoken ".$self->{csrftoken}."\n";
+ print "csrftoken " . $self->{csrftoken} . "\n";
return 0;
}
@@ -56,22 +55,20 @@ sub view($) {
$self->login() unless defined $self->{logged_in};
- my $get = GET( $self->{bmc_url}
- . '/api/remote_control/get/kvm/launch' );
+ my $get = GET( $self->{bmc_url} . '/api/remote_control/get/kvm/launch' );
- $get->header('X-CSRFTOKEN' => $self->{csrftoken});
- $get->header('Cookie' => 'lang=en-us');
+ $get->header( 'X-CSRFTOKEN' => $self->{csrftoken} );
+ $get->header( 'Cookie' => 'lang=en-us' );
my $res = $self->{ua}->request($get);
unless ( $res->is_success ) {
print STDERR "JWSK frequest failed - did not get 200\n";
- print Dumper ($res);
+ print Dumper ($res);
return -1;
}
-
my $xml = new XML::Simple;
my $c = $res->content;
@@ -105,25 +102,26 @@ sub view($) {
print "Filename is $tmp->filename\n";
}
- my $jars = [ ];
+ my $jars = [];
- push @$jars, $prefix.'JViewer.jar';
- push @$jars, $prefix.'JViewer-SOC.jar';
- push @$jars, $prefix.'JViewer-OEM.jar';
- push @$jars, $prefix.'JViewer-AVIStream.jar';
- push @$jars, $prefix.'Linux_x86_64.jar';
- push @$jars, $prefix.'JViewer-FolderRedir.jar';
+ push @$jars, $prefix . 'JViewer.jar';
+ push @$jars, $prefix . 'JViewer-SOC.jar';
+ push @$jars, $prefix . 'JViewer-OEM.jar';
+ push @$jars, $prefix . 'JViewer-AVIStream.jar';
+ push @$jars, $prefix . 'Linux_x86_64.jar';
+ push @$jars, $prefix . 'JViewer-FolderRedir.jar';
my $cp = join( ':', @$jars );
push @$java_args, "-cp";
push @$java_args, $cp;
push @$java_args, "-Djava.library.path=" . $prefix;
+
# push @$java_args, "-Djava.security.manager";
# push @$java_args, "-Djava.security.policy=/usr/local/share/inf/asrock/mypolicy";
# push @$java_args, "-Dcom.sun.net.ssl.checkRevocation=false";
- push @$java_args,"-Xms100m";
- push @$java_args,"-Xmx256m";
+ push @$java_args, "-Xms100m";
+ push @$java_args, "-Xmx256m";
push @$java_args, "com.ami.kvm.jviewer.JViewer";
@@ -279,12 +277,11 @@ sub new ($;$) {
|| 'https://' . $self->{host};
$self->{ua}->ssl_opts(
- SSL_version => 'TLSv1_2',
+ SSL_version => 'TLSv1_2',
SSL_verify_mode => Net::SSLeay::VERIFY_NONE(),
verify_hostname => 0,
);
-
if ( defined $parm->{proxy_host} ) {
$self->{ua}->proxy( [qw(http https)] => "socks://"
. $parm->{proxy_host} . ":"
diff --git a/INF/DSRx020.pm b/INF/DSRx020.pm
index c68274c..94396ed 100644
--- a/INF/DSRx020.pm
+++ b/INF/DSRx020.pm
@@ -399,27 +399,28 @@ sub port_name_set($$$) {
if ( $port =~ /P(\d+)\.(\d+)/ ) {
return $self->spc_set_name( $1, $2, $name );
}
- elsif ($port =~ /K(\d+)/ ) {
- my $index= $1;
- my $res = $self->do_post(
- { file => 'view-units-by-target-devices' },
- [
- file => 'overview-dsr',
- saveParms => 'overview-dsr',
- name => '',
- index => $index,
- targetname => $name,
- action => 'SAVE',
- ]
- );
+ elsif ( $port =~ /K(\d+)/ ) {
+ my $index = $1;
+ my $res = $self->do_post(
+ { file => 'view-units-by-target-devices' },
+ [
+ file => 'overview-dsr',
+ saveParms => 'overview-dsr',
+ name => '',
+ index => $index,
+ targetname => $name,
+ action => 'SAVE',
+ ]
+ );
- #oid => '141057',
+ #oid => '141057',
- $self->flush();
+ $self->flush();
- return undef unless $res->is_success;
- return "Success";
- } else {
+ return undef unless $res->is_success;
+ return "Success";
+ }
+ else {
return undef;
}
}
@@ -463,8 +464,7 @@ sub port_count($) {
return scalar( @{ $self->{ports} } );
}
-sub port_get_topology($$)
-{
+sub port_get_topology($$) {
my ( $self, $port ) = @_;
return unless $port =~ /K(\d+)/;
@@ -492,23 +492,19 @@ sub port_get_topology($$)
return undef unless defined $args;
- my $ret = undef ;
+ my $ret = undef;
for my $arg (@$args) {
-
- next unless $arg =~ /^path=a:[^,]*,p:([0-9]+),c:([0-9]+),/;
- print $arg," -> ", $1, " ",$2 ,"\n";
- return [$1,$2];
+ next unless $arg =~ /^path=a:[^,]*,p:([0-9]+),c:([0-9]+),/;
+ print $arg, " -> ", $1, " ", $2, "\n";
+ return [ $1, $2 ];
}
-
- return undef;
+ return undef;
}
-
-
sub view($$) {
my ( $self, $port ) = @_;
diff --git a/INF/ILO.pm b/INF/ILO.pm
index ba80dcf..577d0c6 100644
--- a/INF/ILO.pm
+++ b/INF/ILO.pm
@@ -204,7 +204,10 @@ sub view($) {
$self->login() unless defined $self->{skey};
- my $get = GET( $self->{ilo_url} . '/html/java_irc.html?lang=en', 'Cookie' => 'sessionKey=' . $self->{skey} );
+ my $get = GET(
+ $self->{ilo_url} . '/html/java_irc.html?lang=en',
+ 'Cookie' => 'sessionKey=' . $self->{skey}
+ );
my $res = $self->{ua}->request($get);
diff --git a/INF/ILO2.pm b/INF/ILO2.pm
index adf5ba2..892f371 100644
--- a/INF/ILO2.pm
+++ b/INF/ILO2.pm
@@ -2,7 +2,8 @@
IO::Socket::SSL::set_ctx_defaults(
SSL_verify_mode => Net::SSLeay::VERIFY_NONE(),
- SSL_version => 'TLSv1' );
+ SSL_version => 'TLSv1'
+);
package INF::ILO2;
diff --git a/INF/ILO5.pm b/INF/ILO5.pm
index a2d68b6..f406762 100644
--- a/INF/ILO5.pm
+++ b/INF/ILO5.pm
@@ -105,7 +105,7 @@ sub setup_port_proxy($$$$) {
sub proxy($$$) {
my ( $self, $req, $res ) = @_;
- my $suri = $req->uri->as_string;
+ my $suri = $req->uri->as_string;
print STDERR "proxying $suri\n";
@@ -129,23 +129,22 @@ sub proxy($$$) {
return;
}
-# print STDERR "fish: ",Dumper($req->headers),"\n";
+ # print STDERR "fish: ",Dumper($req->headers),"\n";
my $proxy_req =
HTTP::Request->new( $req->method, $self->{ilo_url} . $req->uri->as_string,
[], $req->content );
- $proxy_req->header( 'cookie' => 'sessionKey=' . $self->{skey} );
- $proxy_req->header( 'x-auth-token' => $self->{skey} );
+ $proxy_req->header( 'cookie' => 'sessionKey=' . $self->{skey} );
+ $proxy_req->header( 'x-auth-token' => $self->{skey} );
-# print STDERR "soup: ",Dumper($proxy_req->headers),"\n";
+ # print STDERR "soup: ",Dumper($proxy_req->headers),"\n";
#sessionLang=en; externalIrc=ircLocation=/redfish/v1/SessionService/Sessions/administrator0000000060db1eb3cdd2f1a9/
#Location=/redfish/v1/SessionService/Sessions/uxen00000000612e3f404189374c/;
#UserPref=html5_statbar=true%2Ckbd_type=en
#irc=last=jrc
-
my $proxy_res = $self->{ua}->request($proxy_req);
unless ( $proxy_res->is_success ) {
@@ -163,7 +162,7 @@ sub proxy($$$) {
if ( $req->uri->as_string =~ /^\/redfish\/v1\/Managers\/1\/RcInfo/ ) {
- print "content: $content\n";
+ print "content: $content\n";
my $local_port = int( rand(30000) ) + 30000;
@@ -171,7 +170,7 @@ sub proxy($$$) {
push @{ $self->{to_kill} },
$self->setup_port_proxy( $local_port, $self->{host}, $1 );
- print "FISH $1 -> $local_port\n";
+ print "FISH $1 -> $local_port\n";
$local_port = int( rand(30000) ) + 30000;
@@ -179,7 +178,7 @@ sub proxy($$$) {
push @{ $self->{to_kill} },
$self->setup_port_proxy( $local_port, $self->{host}, $1 );
- print "SOUP $1 -> $local_port\n";
+ print "SOUP $1 -> $local_port\n";
}
@@ -211,11 +210,10 @@ sub login($) {
$self->{skey} = undef;
return -1;
}
- print STDERR "Login good!\n";
+ print STDERR "Login good!\n";
my $json = decode_json( $res->content );
-
$self->{skey} = $json->{session_key};
# print "Session key ".$self->{skey}."\n";
@@ -228,7 +226,10 @@ sub view($) {
$self->login() unless defined $self->{skey};
- my $get = GET( $self->{ilo_url} . '/html/java_irc.html?lang=en', 'Cookie' => 'sessionKey=' . $self->{skey} );
+ my $get = GET(
+ $self->{ilo_url} . '/html/java_irc.html?lang=en',
+ 'Cookie' => 'sessionKey=' . $self->{skey}
+ );
my $res = $self->{ua}->request($get);
@@ -243,7 +244,6 @@ sub view($) {
return -1;
}
-
$content = $1;
#$content=~ s/document.writeln\("(.*)"\);$/\1/m;
@@ -261,9 +261,6 @@ sub view($) {
print $content;
-
-
-
my $webserver_pid = fork();
if ( $webserver_pid == 0 ) {