mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-23 10:42:14 +01: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:
parent
774f8406a8
commit
b4afd1a8ea
@ -246,7 +246,11 @@ class KeyringCredentialsManager(AbstractCredentialsManager):
|
|||||||
|
|
||||||
def delete_password(self, url, user):
|
def delete_password(self, url, user):
|
||||||
self._load_backend()
|
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):
|
class KeyringCredentialsDescriptor(AbstractCredentialsManagerDescriptor):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user