1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-21 01:36:16 +02:00

Avoid crash when deleting a password

When using keyring, osc would crash when called as
`osc config ENDPOINT --change-password`
and when the password didn't exist in the backend.

This prevents it by first checking if a password exists.
This commit is contained in:
mig4 2022-11-01 18:40:39 +00:00
parent 774f8406a8
commit b4afd1a8ea
No known key found for this signature in database
GPG Key ID: 81A0B90BAE3D3CF4

View File

@ -246,7 +246,11 @@ class KeyringCredentialsManager(AbstractCredentialsManager):
def delete_password(self, url, user):
self._load_backend()
keyring.delete_password(urlsplit(url)[1], user)
service = urlsplit(url)[1]
data = keyring.get_password(service, user)
if data is None:
return
keyring.delete_password(service, user)
class KeyringCredentialsDescriptor(AbstractCredentialsManagerDescriptor):