add get_DBName routine
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4980 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
bd94e52135
commit
d482c3c2ac
@ -5459,5 +5459,49 @@ sub updateEtcHosts
|
||||
close( HOSTS );
|
||||
return [$host,$ip];
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getDBName
|
||||
Description:
|
||||
Returns the current database (SQLITE,DB2,MYSQL,PG)
|
||||
|
||||
Arguments:
|
||||
None
|
||||
Returns:
|
||||
Return string.
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $DBname = xCAT::Utils->getDBName;
|
||||
Comments:
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_DBName
|
||||
{
|
||||
my $name = "SQLITE"; # default
|
||||
my $xcatcfg;
|
||||
if (-r "/etc/xcat/cfgloc") {
|
||||
my $cfgl;
|
||||
open($cfgl,"<","/etc/xcat/cfgloc");
|
||||
$xcatcfg = <$cfgl>;
|
||||
close($cfgl);
|
||||
if ($xcatcfg =~ /^mysql:/) {
|
||||
$name="MYSQL"
|
||||
} else {
|
||||
if ($xcatcfg =~ /^DB2:/) {
|
||||
$name="DB2"
|
||||
} else {
|
||||
if ($xcatcfg =~ /^Pg:/) {
|
||||
$name="PG"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user