Skip to content

Commit c39c142

Browse files
Fix #3579: Replace subprocess.call() with check_call() in db.py to prevent silent failures
Signed-off-by: guptapratykshh <pratykshgupta9999@gmail.com>
1 parent 8ec768d commit c39c142

File tree

1 file changed

+6
-6
lines changed
  • augur/application/cli

1 file changed

+6
-6
lines changed

augur/application/cli/db.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from os import environ, chmod, path, getenv
44
import logging
55
from sys import exit
6-
from subprocess import call
6+
from subprocess import check_call
77
import random
88
import string
99
import click
@@ -280,7 +280,7 @@ def print_db_version():
280280
"""
281281
Get the version of the configured database
282282
"""
283-
call(["alembic", "current"])
283+
check_call(["alembic", "current"])
284284

285285

286286
@cli.command("upgrade-db-version")
@@ -290,7 +290,7 @@ def upgrade_db_version():
290290
"""
291291
Upgrade the configured database to the latest version
292292
"""
293-
call(["alembic", "upgrade", "head"])
293+
check_call(["alembic", "upgrade", "head"])
294294

295295

296296
@cli.command("check-for-upgrade")
@@ -300,7 +300,7 @@ def check_for_upgrade():
300300
"""
301301
Upgrade the configured database to the latest version
302302
"""
303-
call(["alembic", "history", "-i"])
303+
check_call(["alembic", "history", "-i"])
304304

305305

306306
@cli.command("create-schema")
@@ -310,7 +310,7 @@ def create_schema():
310310
"""
311311
Create schema in the configured database
312312
"""
313-
call(["alembic", "upgrade", "head"])
313+
check_call(["alembic", "upgrade", "head"])
314314

315315

316316
def generate_key(length):
@@ -513,7 +513,7 @@ def run_psql_command_in_database(target_type, target):
513513
db_conn_string = f"postgresql+psycopg2://{db_config['user']}:{db_config['password']}@{db_config['host']}:{db_config['port']}/{db_config['database_name']}"
514514
engine = s.create_engine(db_conn_string)
515515

516-
call(
516+
check_call(
517517
[
518518
"psql",
519519
"-h",

0 commit comments

Comments
 (0)