#989 netdisco-deploy and netdisco-db-deploy respect ND2_DB_ROLLBACK

This commit is contained in:
Oliver Gorwits
2023-03-08 13:49:02 +00:00
parent b33737a335
commit db112d99cd
3 changed files with 17 additions and 0 deletions

View File

@@ -107,6 +107,10 @@ if ($pg_ver and $pg_ver < 90600) {
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') {
$schema->storage->dbh_do(
sub {
@@ -156,4 +160,5 @@ for (my $i = $db_version; $i < $target_version; $i++) {
};
}
undef $txn_guard if $ENV{ND2_DB_ROLLBACK};
exit 0;