2007-10-26 22:44:33 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
2007-12-18 18:24:16 +00:00
|
|
|
BEGIN
|
|
|
|
{
|
|
|
|
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
|
|
|
}
|
|
|
|
use lib "$::XCATROOT/lib/perl";
|
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
use xCAT::Table;
|
2008-03-11 20:27:46 +00:00
|
|
|
use xCAT::Utils;
|
2007-10-26 22:44:33 +00:00
|
|
|
use File::Basename;
|
|
|
|
my $scriptname = $0;
|
|
|
|
|
|
|
|
$mptab = xCAT::Table->new('mp');
|
|
|
|
unless ($mptab) {
|
|
|
|
sleep 5; #Try not to overwhelm logfiles...
|
|
|
|
die "mp table must be configured";
|
|
|
|
}
|
|
|
|
$mpatab = xCAT::Table->new('mpa');
|
|
|
|
$passtab = xCAT::Table->new('passwd');
|
|
|
|
|
|
|
|
my $username = "USERID";
|
|
|
|
my $passsword = "PASSW0RD";
|
|
|
|
my $mm;
|
|
|
|
my $slot;
|
|
|
|
my $dba;
|
|
|
|
if ($passtab) {
|
|
|
|
($dba) = $passtab->getAttribs({key=>blade},qw(username password));
|
|
|
|
if ($dba->{username}) {
|
|
|
|
$username = $dba->{username};
|
|
|
|
}
|
|
|
|
if ($dba->{password}) {
|
|
|
|
$password = $dba->{password};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$dba = $mptab->getNodeAttribs($ARGV[0],[qw(mpa id)]);
|
|
|
|
$mm = $dba->{mpa};
|
|
|
|
$slot = $dba->{id};
|
|
|
|
if ($mpatab) {
|
|
|
|
($dba) = $mpatab->getAttribs({mpa=>$mm},qw(username password));
|
|
|
|
if ($dba) {
|
2007-12-18 18:24:16 +00:00
|
|
|
if ($dba->{username}) { $username = $dba->{username}; }
|
|
|
|
if ($dba->{password}) { $password = $dba->{password}; }
|
2007-10-26 22:44:33 +00:00
|
|
|
}
|
|
|
|
}
|
2008-03-11 20:27:46 +00:00
|
|
|
xCAT::Utils::close_all_dbhs;
|
|
|
|
sleep 5; #Slow start, I know, but with exec, can't return
|
2007-11-26 15:43:17 +00:00
|
|
|
exec "ssh -t $username"."@"."$mm console -o -T blade[$slot]";
|
|
|
|
#my $pathtochild= dirname($scriptname). "/";
|
|
|
|
#exec $pathtochild."blade.expect $mm $slot $username $password";
|
2007-10-26 22:44:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|