aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
411 stars 184 forks source link

`verdi presto --use-postgres` with existing profile name still creates PSQL db #6482

Closed GeigerJ2 closed 23 hours ago

GeigerJ2 commented 1 week ago

Quite minor issue, though still adding it here for future reference. As the title says, running verdi presto --use-postgres specifying an already existing profile still creates the PSQL db, and only afterwards fails during profile creation:

❯ verdi presto --profile-name 'psql-presto' --use-postgres
Report: `--use-postgres` enabled and database creation successful: configuring the profile to use PostgreSQL.
Report: RabbitMQ server detected: configuring the profile with a broker.
Report: Initialising the storage backend.
Report: Storage initialisation completed.
Success: Created new profile `psql-presto`.
Success: Configured the localhost as a computer.

❯ verdi presto --profile-name 'psql-presto' --use-postgres
Warning: Database "aiida-psql-presto" already exists.
Report: `--use-postgres` enabled and database creation successful: configuring the profile to use PostgreSQL.
Report: RabbitMQ server detected: configuring the profile with a broker.
Critical: The profile `psql-presto` already exists.

leading to:

❯ psql -l
                                                                                           List of databases
                            Name                            |                         Owner                         | Encoding |   Collate   |    Ctype    |             Access privileges             
------------------------------------------------------------+-------------------------------------------------------+----------+-------------+-------------+------------------------------------------- 
 aiida-psql-presto                                          | aiida-psql-presto                                     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 aiida-psql-presto_1                                        | aiida-psql-presto                                     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 

I think it would be nicer if it wouldn't create the db, if the profile already exists, as well as a db with the same name.