From 728102b4eb3e9311213fc4ac36b8734b832f524c Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Tue, 17 Nov 2020 20:27:21 +0100 Subject: [PATCH 1/2] Enforce verdi quicksetup --non-interactive When in non-interactive mode, do not ask whether to use existing user/database --- aiida/manage/external/postgres.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aiida/manage/external/postgres.py b/aiida/manage/external/postgres.py index c4faff90c1..91533b23d7 100644 --- a/aiida/manage/external/postgres.py +++ b/aiida/manage/external/postgres.py @@ -116,6 +116,8 @@ def check_dbuser(self, dbuser): :param str dbuser: Name of the user to be created or reused. :returns: tuple (dbuser, created) """ + if not self.interactive: + return dbuser, not self.dbuser_exists(dbuser) create = True while create and self.dbuser_exists(dbuser): echo.echo_info(f'Database user "{dbuser}" already exists!') @@ -163,6 +165,8 @@ def check_db(self, dbname): :param str dbname: Name of the database to be created or reused. :returns: tuple (dbname, created) """ + if not self.interactive: + return dbname, not self.db_exists(dbuser) create = True while create and self.db_exists(dbname): echo.echo_info(f'database {dbname} already exists!') From 9cf4a65d1c03febcda06f1ba55065a748956ab61 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Tue, 17 Nov 2020 20:44:50 +0100 Subject: [PATCH 2/2] Update aiida/manage/external/postgres.py --- aiida/manage/external/postgres.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiida/manage/external/postgres.py b/aiida/manage/external/postgres.py index 91533b23d7..0a6ff8f937 100644 --- a/aiida/manage/external/postgres.py +++ b/aiida/manage/external/postgres.py @@ -166,7 +166,7 @@ def check_db(self, dbname): :returns: tuple (dbname, created) """ if not self.interactive: - return dbname, not self.db_exists(dbuser) + return dbname, not self.db_exists(dbname) create = True while create and self.db_exists(dbname): echo.echo_info(f'database {dbname} already exists!')