Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyring failures give bad error messages #58

Open
jameinel opened this issue Jul 25, 2022 · 1 comment
Open

Keyring failures give bad error messages #58

jameinel opened this issue Jul 25, 2022 · 1 comment

Comments

@jameinel
Copy link
Member

I'm running on a headless machine, and apparently there is something wrong with my exported credential.
However, when I try to do something, the error message is very unhelpful:

$ charmcraft names
charmcraft internal error: InitError('Failed to create the collection: Prompt dismissed..')
Full execution log: '/home/jameinel/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220725-102753.314065.log'
$ charmcraft version
1.7.1
$ snap info charmcraft
name:      charmcraft
summary:   The charming tool
publisher: Canonical✓
store-url: https://snapcraft.io/charmcraft
license:   Apache-2.0
description: |
  Charmcraft enables charm creators to build, publish, and manage charmed operators for Kubernetes,
  metal and virtual machines.
commands:
  - charmcraft
snap-id:      gcqfpVCOUvmDuYT0Dh5PjdeGypSEzNdV
tracking:     latest/stable
...

The full execution log is:

2022-07-25 10:27:53.314 Starting charmcraft version 1.7.1
2022-07-25 10:27:53.314 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'trace': False, 'project_dir': None} filtered=['names']
2022-07-25 10:27:53.314 General parsed sysargs: command='names' args=[]
2022-07-25 10:27:53.314 Couldn't find config file '/home/jameinel/dev/juju/juju-qa-jenkins/charmcraft.yaml'
2022-07-25 10:27:53.315 Command parsed sysargs: Namespace()
2022-07-25 10:27:53.315 System details: OSPlatform(system='ubuntu', release='20.04', machine='x86_64'); Environment: None
2022-07-25 10:27:53.389 Retrieving credentials for 'charmcraft' on 'api.charmhub.io' from keyring 'SecretService Keyring'.
2022-07-25 10:27:53.411 Unhandled exception raised when retrieving credentials: InitError('Failed to create the collection: Prompt dismissed..')
2022-07-25 10:27:53.411 Credentials not found. Trying to log in...
2022-07-25 10:27:53.434 charmcraft internal error: InitError('Failed to create the collection: Prompt dismissed..')
2022-07-25 10:27:53.436 Traceback (most recent call last):
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/secretstorage/util.py", line 48, in send_and_get_reply
2022-07-25 10:27:53.436     raise DBusErrorResponse(resp_msg)
2022-07-25 10:27:53.436 jeepney.wrappers.DBusErrorResponse: [org.freedesktop.DBus.Error.UnknownMethod] ('No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login',)
2022-07-25 10:27:53.436
2022-07-25 10:27:53.436 The above exception was the direct cause of the following exception:
2022-07-25 10:27:53.436 Traceback (most recent call last):
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/secretstorage/collection.py", line 161, in get_default_collection
2022-07-25 10:27:53.436     return Collection(connection)
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/secretstorage/collection.py", line 44, in __init__
2022-07-25 10:27:53.436     self._collection.get_property('Label')
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/secretstorage/util.py", line 67, in get_property
2022-07-25 10:27:53.436     (signature, value), = self.send_and_get_reply(msg)
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/secretstorage/util.py", line 52, in send_and_get_reply
2022-07-25 10:27:53.436     raise ItemNotFoundException('Item does not exist!') from resp
2022-07-25 10:27:53.436 secretstorage.exceptions.ItemNotFoundException: Item does not exist!
2022-07-25 10:27:53.436
2022-07-25 10:27:53.436 During handling of the above exception, another exception occurred:
2022-07-25 10:27:53.436 Traceback (most recent call last):
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/keyring/backends/SecretService.py", line 61, in get_preferred_collection
2022-07-25 10:27:53.436     collection = secretstorage.get_default_collection(bus)
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/secretstorage/collection.py", line 163, in get_default_collection
2022-07-25 10:27:53.436     return create_collection(connection, 'Default',
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/secretstorage/collection.py", line 145, in create_collection
2022-07-25 10:27:53.436     raise PromptDismissedException('Prompt dismissed.')
2022-07-25 10:27:53.436 secretstorage.exceptions.PromptDismissedException: Prompt dismissed.
2022-07-25 10:27:53.436
2022-07-25 10:27:53.436 During handling of the above exception, another exception occurred:
2022-07-25 10:27:53.436 Traceback (most recent call last):
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/charmcraft/main.py", line 167, in main
2022-07-25 10:27:53.436     retcode = dispatcher.run()
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/craft_cli/dispatcher.py", line 406, in run
2022-07-25 10:27:53.436     return self._loaded_command.run(self._parsed_command_args)
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/charmcraft/commands/store/__init__.py", line 390, in run
2022-07-25 10:27:53.436     result = store.list_registered_names()
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/charmcraft/commands/store/store.py", line 165, in error_decorator
2022-07-25 10:27:53.436     self.login()
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/charmcraft/commands/store/store.py", line 210, in login
2022-07-25 10:27:53.436     return self._client.login(**kwargs)
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/charmcraft/commands/store/client.py", line 74, in login
2022-07-25 10:27:53.436     return super().login(*args, **kwargs)
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/craft_store/base_client.py", line 130, in login
2022-07-25 10:27:53.436     self._auth.ensure_no_credentials()
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/craft_store/auth.py", line 131, in ensure_no_credentials
2022-07-25 10:27:53.436     if self._keyring.get_password(self.application_name, self.host) is not None:
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/keyring/backends/SecretService.py", line 78, in get_password
2022-07-25 10:27:53.436     collection = self.get_preferred_collection()
2022-07-25 10:27:53.436   File "/snap/charmcraft/978/lib/keyring/backends/SecretService.py", line 63, in get_preferred_collection
2022-07-25 10:27:53.436     raise InitError("Failed to create the collection: %s." % e)
2022-07-25 10:27:53.436 keyring.errors.InitError: Failed to create the collection: Prompt dismissed..
2022-07-25 10:27:53.436 Full execution log: '/home/jameinel/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220725-102753.314065.log'
@facundobatista facundobatista transferred this issue from canonical/charmcraft Aug 1, 2022
@facundobatista
Copy link

Transferred this issue from charmcraft project, as this should be caught generically by craft-store and raise a proper error (so all projects using this lib benefit from the improvement)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants