Merge ~johnsca/layer-snap:bug/version-split into ~stub/layer-snap:master

Proposed by Cory Johns
Status: Merged
Merged at revision: 9f8b9a03f57b528d200d037789db910ca79698b9
Proposed branch: ~johnsca/layer-snap:bug/version-split
Merge into: ~stub/layer-snap:master
Diff against target: 11 lines (+1/-1)
1 file modified
reactive/snap.py (+1/-1)
Reviewer Review Type Date Requested Status
Stuart Bishop Approve
Review via email: mp+377453@code.launchpad.net

Description of the change

The new version of snapd (2.43) adds a `host` line to the output of `snap version` which can include multiple spaces if running on KVM.

Fixes https://bugs.launchpad.net/layer-snap/+bug/1859211

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Ta. Better to be defensive.

We probably still need snapd upstream to alter the format so old code continues to work, and a test to catch regressions; production deploys of the existing code will remain live for years ahead.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/reactive/snap.py b/reactive/snap.py
2index 89d12c4..882280a 100644
3--- a/reactive/snap.py
4+++ b/reactive/snap.py
5@@ -232,7 +232,7 @@ def _get_snapd_version():
6 stdin=subprocess.DEVNULL,
7 universal_newlines=True
8 )
9- version_info = dict(line.split() for line in stdout.splitlines())
10+ version_info = dict(line.split(None, 1) for line in stdout.splitlines())
11 return LooseVersion(version_info['snapd'])
12
13

Subscribers

People subscribed via source and target branches

to all changes: