-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
verdi profile delete
: Make it storage plugin agnostic (#6224)
The `verdi profile delete` implementation was hardcoded to work only for the `core.psql_dos` storage plugin. However, it is possible for profiles to use different storage plugins, causing the command to except. The command now forwards to `Config.delete_profile`. This method gets the storage plugin defined for the profile and constructs an instance of it for the given profile. It then calls `delete` on the storage instance if the `delete_storage` argument is set to `True`. The new `delete` method is defined on the `StorageBackend` abstract base class. It is intentionally not made abstract, but rather explicitly raises `NotImplementedError`. Otherwise existing storage plugins outside of `aiida-core` would no longer be instantiable before they implement the method. The various options of `verdi profile delete` to control what parts of the storage are deleted, are simplified to just a single switch that controls whether the storage is deleted or not. The switch is not defined at all by default. The user will have to explicitly select either `--delete-data` or `--keep-data`, or they will be prompted what value to choose. If the `--force` flag is specified and no explicit flag to delete or keep the data, the command raises. The command now also properly detects if the delete profile was the default, in which case another profile is marked as the new default if any profiles remain at all.
- Loading branch information
Showing
9 changed files
with
149 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters