#989 netdisco-deploy and netdisco-db-deploy respect ND2_DB_ROLLBACK
This commit is contained in:
@@ -107,6 +107,10 @@ if ($pg_ver and $pg_ver < 90600) {
|
|||||||
die "\n";
|
die "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# roll everything back if we're testing
|
||||||
|
my $txn_guard = $ENV{ND2_DB_ROLLBACK}
|
||||||
|
? schema('netdisco')->storage->txn_scope_guard : undef;
|
||||||
|
|
||||||
if (scalar @ARGV and $ARGV[0] and $ARGV[0] eq '--redeploy-all') {
|
if (scalar @ARGV and $ARGV[0] and $ARGV[0] eq '--redeploy-all') {
|
||||||
$schema->storage->dbh_do(
|
$schema->storage->dbh_do(
|
||||||
sub {
|
sub {
|
||||||
@@ -156,4 +160,5 @@ for (my $i = $db_version; $i < $target_version; $i++) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
undef $txn_guard if $ENV{ND2_DB_ROLLBACK};
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|||||||
@@ -176,6 +176,10 @@ sub deploy_db {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# roll everything back if we're testing
|
||||||
|
my $txn_guard = $ENV{ND2_DB_ROLLBACK}
|
||||||
|
? schema('netdisco')->storage->txn_scope_guard : undef;
|
||||||
|
|
||||||
# set up initial admin user
|
# set up initial admin user
|
||||||
my $users = schema('netdisco')->resultset('User');
|
my $users = schema('netdisco')->resultset('User');
|
||||||
if ($users->search({-bool => 'admin'})->count == 0) {
|
if ($users->search({-bool => 'admin'})->count == 0) {
|
||||||
@@ -247,6 +251,10 @@ sub deploy_oui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((scalar keys %data) > 15_000) {
|
if ((scalar keys %data) > 15_000) {
|
||||||
|
# roll everything back if we're testing
|
||||||
|
my $txn_guard = $ENV{ND2_DB_ROLLBACK}
|
||||||
|
? schema('netdisco')->storage->txn_scope_guard : undef;
|
||||||
|
|
||||||
$schema->txn_do(sub{
|
$schema->txn_do(sub{
|
||||||
$schema->resultset('Oui')->delete;
|
$schema->resultset('Oui')->delete;
|
||||||
$schema->resultset('Oui')->populate([
|
$schema->resultset('Oui')->populate([
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ sub update_stats {
|
|||||||
my $snmpinfo_ver = ($@ ? 'n/a' : $SNMP::Info::VERSION);
|
my $snmpinfo_ver = ($@ ? 'n/a' : $SNMP::Info::VERSION);
|
||||||
my $postgres_ver = pretty_version($schema->storage->dbh->{pg_server_version}, 2);
|
my $postgres_ver = pretty_version($schema->storage->dbh->{pg_server_version}, 2);
|
||||||
|
|
||||||
|
# roll everything back if we're testing
|
||||||
|
my $txn_guard = $ENV{ND2_DB_ROLLBACK}
|
||||||
|
? $schema->storage->txn_scope_guard : undef;
|
||||||
|
|
||||||
# TODO: (when we have the capabilities table?)
|
# TODO: (when we have the capabilities table?)
|
||||||
# $stats{waps} = sql_scalar('device',['COUNT(*)'], {"model"=>"AIR%"});
|
# $stats{waps} = sql_scalar('device',['COUNT(*)'], {"model"=>"AIR%"});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user