Comment 1 for bug 2060173

Revision history for this message
Jadon Naas (jadonn) wrote :

I confirmed the version check failing is happening for the Vault snap on version 1.15.6 on 1.15/stable right now. I got this error when I worked through the commands in the get_vault_snap_version() function:

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Is this the kind of error you were seeing?

Also, what version of the Vault snap are you using? I did not get this error on version 1.5.9 of the Vault snap, for example.

Thank you for the fix suggestion! I did confirm that the fix you suggested would work. Here is output from working through that fix you provided:

>>> snapd = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>>> snapd.connect(SNAPD_SOCKET)
>>> snapd.sendall(SNAPD_INFO_REQUEST.format(snap='vault').encode('utf-8'))
>>> original_response = snapd.recv(1024 * 1024).decode('utf-8').split('\n')
>>> result = [ele for ele in original_response if "vault" in ele]
>>> info = json.loads(result[0])
>>> print(info)
{'type': 'sync', 'status-code': 200, 'status': 'OK', 'result': {'id': 'bIb4p4yWWjyZdo2EU64whkZhw9QYYsMH', 'title': 'vault', 'summary': 'Vault is a tool for securely accessing secrets.', 'description': 'A modern system requires access to a multitude of secrets: database\ncredentials, API keys for external services, credentials for service-oriented\narchitecture communication, etc. Understanding who is accessing what secrets\nis already very difficult and platform-specific. Adding on key rolling,\nsecure storage, and detailed audit logs is almost impossible without a custom\nsolution. This is where Vault steps in.\n\nThis snap is maintained by Canonical.\n\n**Usage**\n \n* To start the Vault service, edit the configuration file at `/var/snap/vault/common/vault.hcl` and start the service with `sudo snap start vault.vaultd`.\n\n* To use the Vault Client, run `vault` commands. For example: `vault status`.', 'icon': 'https://dashboard.snapcraft.io/site_media/appmedia/2017/09/android-chrome-512x512.png', 'installed-size': 191340544, 'install-date': '2024-04-09T19:44:21.65660055Z', 'name': 'vault', 'publisher': {'id': 'canonical', 'username': 'canonical', 'display-name': 'Canonical', 'validation': 'verified'}, 'developer': 'canonical', 'status': 'active', 'type': 'app', 'base': 'core22', 'version': '1.15.6', 'channel': '1.15/stable', 'tracking-channel': '1.15/stable', 'ignore-validation': False, 'revision': '2213', 'confinement': 'strict', 'private': False, 'devmode': False, 'jailmode': False, 'apps': [{'snap': 'vault', 'name': 'vault'}, {'snap': 'vault', 'name': 'vaultd', 'daemon': 'simple', 'daemon-scope': 'system'}], 'mounted-from': '/var/lib/snapd/snaps/vault_2213.snap', 'links': {'issues': ['https://github.com/canonical/snap-vault/issues'], 'source': ['https://github.com/hashicorp/vault'], 'website': ['https://github.com/canonical/snap-vault', 'https://www.vaultproject.io/']}, 'contact': '', 'website': 'https://github.com/canonical/snap-vault', 'media': [{'type': 'icon', 'url': 'https://dashboard.snapcraft.io/site_media/appmedia/2017/09/android-chrome-512x512.png', 'width': 256, 'height': 256}, {'type': 'screenshot', 'url': 'https://dashboard.snapcraft.io/site_media/appmedia/2024/03/Screenshot_from_2024-03-20_16-12-04-1710965788.png', 'width': 873, 'height': 500}, {'type': 'screenshot', 'url': 'https://dashboard.snapcraft.io/site_media/appmedia/2024/03/Screenshot_from_2024-03-20_16-15-49-1710965788.png', 'width': 1793, 'height': 1068}]}}
>>> version = info['result']['version']
>>> print(version)
1.15.6

Can you provide the version of the Vault snap you are using to make sure we test against the correct version?