secrets-tool command for bootstrapping database.

This additional secrets-tool command can be used to run the database
bootsrapping script (`script/database_setup.py`) inside an ATAT docker
container against the Azure database. It sources the necessary keys from
Key Vault.
This commit is contained in:
dandds
2020-01-23 15:35:35 -05:00
parent 49a1a219ae
commit a8f6befc17
6 changed files with 185 additions and 13 deletions

View File

@@ -1,13 +1,11 @@
# Add root application dir to the python path
import os
import sys
from contextlib import contextmanager
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(parent_dir)
import sqlalchemy
from alembic import config as alembic_config
import yaml
from atst.app import make_config, make_app
@@ -25,7 +23,6 @@ def database_setup(username, password, dbname, ccpo_users):
try:
_create_database_user(username, password, dbname)
except sqlalchemy.exc.ProgrammingError as err:
raise err
print(f"Postgres user role '{username}' already exists.")
print("Applying schema and seeding roles and permissions.")