-Remove error-inducing lines from templates (errors were in commented out template portions, so no functional impact).
-Revamp Table.pm to share database handles and have handles persist across object instances, avoiding numerous calls to connect in certain programmer use cases. -Modify xfork to use the aforementioned structure rather than the generic structures which are warned as being read-only -Remove probably deprecated interface field as a key in mac table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@317 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
3a2595953a
commit
c7868bf082
@ -56,7 +56,7 @@ package xCAT::Schema;
|
||||
},
|
||||
mac => {
|
||||
cols => [qw(node interface mac comments disable)],
|
||||
keys => [qw(node interface)],
|
||||
keys => [qw(node)],
|
||||
},
|
||||
chain => {
|
||||
cols => [qw(node currstate currchain chain ondiscover comments disable)],
|
||||
|
@ -159,16 +159,16 @@ sub new
|
||||
$self->{colnames} = \@{$self->{schema}->{cols}};
|
||||
my %otherargs = @_;
|
||||
my $create = $otherargs{'-create'}; #(scalar(@_) == 1 ? shift : 0);
|
||||
my $autocommit = $otherargs{'-autocommit'};
|
||||
$self->{autocommit} = $otherargs{'-autocommit'};
|
||||
|
||||
unless (defined($autocommit))
|
||||
unless (defined($self->{autocommit}))
|
||||
{
|
||||
$autocommit = 1;
|
||||
$self->{autocommit} = 1;
|
||||
}
|
||||
|
||||
my $class = ref($proto) || $proto;
|
||||
my $dbuser="";
|
||||
my $dbpass="";
|
||||
$self->{dbuser}="";
|
||||
$self->{dbpass}="";
|
||||
|
||||
my $xcatcfg = (defined $ENV{'XCATCFG'} ? $ENV{'XCATCFG'} : '');
|
||||
if ($xcatcfg =~ /^$/)
|
||||
@ -210,13 +210,18 @@ sub new
|
||||
}
|
||||
else #Generic DBI
|
||||
{
|
||||
($self->{connstring},$dbuser,$dbpass) = split(/\|/,$xcatcfg);
|
||||
($self->{connstring},$self->{dbuser},$self->{dbpass}) = split(/\|/,$xcatcfg);
|
||||
$self->{connstring} =~ s/^dbi://;
|
||||
$self->{connstring} =~ s/^/dbi:/;
|
||||
#return undef;
|
||||
}
|
||||
$self->{dbh} =
|
||||
DBI->connect($self->{connstring}, $dbuser, $dbpass, {AutoCommit => $autocommit});
|
||||
unless ($::XCAT_DBHS->{$self->{connstring},$self->{dbuser},$self->{dbpass},$self->{autocommit}}) { #= $self->{tabname};
|
||||
$::XCAT_DBHS->{$self->{connstring},$self->{dbuser},$self->{dbpass},$self->{autocommit}} =
|
||||
DBI->connect($self->{connstring}, $self->{dbuser}, $self->{dbpass}, {AutoCommit => $self->{autocommit}});
|
||||
}
|
||||
|
||||
$self->{dbh} = $::XCAT_DBHS->{$self->{connstring},$self->{dbuser},$self->{dbpass},$self->{autocommit}};
|
||||
#DBI->connect($self->{connstring}, $self->{dbuser}, $self->{dbpass}, {AutoCommit => $autocommit});
|
||||
if ($xcatcfg =~ /^SQLite:/)
|
||||
{
|
||||
my $dbexistq =
|
||||
@ -1570,8 +1575,8 @@ sub getTable
|
||||
sub close
|
||||
{
|
||||
my $self = shift;
|
||||
if ($self->{dbh}) { $self->{dbh}->disconnect(); }
|
||||
undef $self->{dbh};
|
||||
#if ($self->{dbh}) { $self->{dbh}->disconnect(); }
|
||||
#undef $self->{dbh};
|
||||
if ($self->{tabname} eq 'nodelist') {
|
||||
undef $self->{nodelist};
|
||||
} else {
|
||||
@ -1632,6 +1637,7 @@ sub open
|
||||
sub DESTROY
|
||||
{
|
||||
my $self = shift;
|
||||
$self->{dbh} = '';
|
||||
undef $self->{dbh};
|
||||
#if ($self->{dbh}) { $self->{dbh}->disconnect(); undef $self->{dbh};}
|
||||
undef $self->{nodelist}; #Could be circular
|
||||
|
@ -110,15 +110,11 @@ sub xfork {
|
||||
return $rc;
|
||||
}
|
||||
unless ($rc) {
|
||||
my %drivers = DBI->installed_drivers;
|
||||
foreach my $drh (values %drivers) {
|
||||
foreach (@{$drh->{ChildHandles}}) {
|
||||
$_->{InactiveDestroy} = 1;
|
||||
}
|
||||
foreach (@{$drh->{ChildHandles}}) {
|
||||
undef $_;
|
||||
}
|
||||
}
|
||||
#my %drivers = DBI->installed_drivers;
|
||||
foreach (values %{$::XCAT_DBHS}) { #@{$drh->{ChildHandles}}) {
|
||||
$_->{InactiveDestroy} = 1;
|
||||
undef $_;
|
||||
}
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
|
@ -124,7 +124,6 @@ skipx
|
||||
#rootpw --iscrypted XaLGAVe1C41x2
|
||||
#rootpw XaLGAVe1C41x2 --iscrypted
|
||||
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
|
||||
#rootpw --iscrypted #COMMAND:perl -e 'print crypt("#TABLE:passwd.tab:rootpw:1#","Xa") . "\n";'p#
|
||||
|
||||
#
|
||||
# NIS setup: auth --enablenis --nisdomain sensenet
|
||||
|
@ -125,7 +125,6 @@ skipx
|
||||
#rootpw --iscrypted XaLGAVe1C41x2
|
||||
#rootpw XaLGAVe1C41x2 --iscrypted
|
||||
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
|
||||
#rootpw --iscrypted #COMMAND:perl -e 'print crypt("#TABLE:passwd.tab:rootpw:1#","Xa") . "\n";'p#
|
||||
|
||||
#
|
||||
# NIS setup: auth --enablenis --nisdomain sensenet
|
||||
|
@ -125,7 +125,6 @@ skipx
|
||||
#rootpw --iscrypted XaLGAVe1C41x2
|
||||
#rootpw XaLGAVe1C41x2 --iscrypted
|
||||
rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
|
||||
#rootpw --iscrypted #COMMAND:perl -e 'print crypt("#TABLE:passwd.tab:rootpw:1#","Xa") . "\n";'p#
|
||||
|
||||
#
|
||||
# NIS setup: auth --enablenis --nisdomain sensenet
|
||||
|
Loading…
Reference in New Issue
Block a user