-
Notifications
You must be signed in to change notification settings - Fork 439
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
Use architectures field which existed in older LXD #1305
Conversation
snapcraft/internal/lxd.py
Outdated
@@ -55,7 +55,7 @@ def __init__(self, *, output, source, project_options, | |||
_verify_remote(remote) | |||
self._container_name = '{}:snapcraft-{}'.format(remote, container_name) | |||
# Use the server architecture to avoid emulation overhead | |||
kernel = self._get_remote_info()['environment']['kernel_architecture'] | |||
kernel = self._get_remote_info()['environment']['architectures'][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is riskier I think.
How do you know that the first architecture is always the kernel architecture? And I'm not sure if yaml.load guarantees the order in lists.
I was thinking of just trying with both values, like:
try:
kernel = self._get_remote_info()['environment']['kernel_architecture']
except KeyError:
kernel = self._get_remote_info()['environment']['kernelarchitecture']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know because that's what LXD does in the source code. But I have no strong opinion one way or the other, so I'm happy to go for the fallback instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are sure this is not flaky, I'm ok with the approach that you prefer.
Codecov Report
@@ Coverage Diff @@
## master #1305 +/- ##
==========================================
- Coverage 95.26% 95.25% -0.01%
==========================================
Files 224 224
Lines 20792 20796 +4
Branches 1662 1662
==========================================
+ Hits 19808 19810 +2
- Misses 682 684 +2
Partials 302 302
Continue to review full report at Codecov.
|
LXD recently renamed the kernelarchitecture field to kernel-architecture so snapcraft is unwittingly not backwards-compatible.
This was filed as bug 1689712.