xcat-core/xCAT-server-2.0/share/xcat/cons/blade
jbjohnso f51ca380b5 -Have Table plugin read, if available, /etc/xcat/cfgloc automatically if not instructed by XCATCFG
-Add utility for zapping all open database connections
-Use aforementioned utility in ipmi and blade console methods to have cleaner database communication
-Remove the suboptimal /etc/sysconfig/xcat code from the console methods


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@763 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
2008-03-11 20:27:46 +00:00

56 lines
1.3 KiB
Perl
Executable File

#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
}
use lib "$::XCATROOT/lib/perl";
use xCAT::Table;
use xCAT::Utils;
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) {
if ($dba->{username}) { $username = $dba->{username}; }
if ($dba->{password}) { $password = $dba->{password}; }
}
}
xCAT::Utils::close_all_dbhs;
sleep 5; #Slow start, I know, but with exec, can't return
exec "ssh -t $username"."@"."$mm console -o -T blade[$slot]";
#my $pathtochild= dirname($scriptname). "/";
#exec $pathtochild."blade.expect $mm $slot $username $password";