1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-06 23:53:39 +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

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):