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
asserts,image: add support for new kernel=track syntax #5563
Conversation
This also removes the "kernel-track:" key in the model assertion.
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.
where do we check that track is only a track? only in image? we might want to add some check in device_asserts.go that kernel: doesn't contain /
@@ -78,12 +78,18 @@ func (mod *Model) Gadget() string { | |||
|
|||
// Kernel returns the kernel snap the model uses. | |||
func (mod *Model) Kernel() string { | |||
return mod.HeaderString("kernel") | |||
kernel := mod.HeaderString("kernel") | |||
return strings.SplitN(kernel, "=", 2)[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.
if we make =track syntax general in model, it seems longer term this kind of accessor on model will need to return a struct with snap-name, track instead of having two accessors. not a blocker for now though
Codecov Report
@@ Coverage Diff @@
## master #5563 +/- ##
==========================================
+ Coverage 79.11% 79.15% +0.03%
==========================================
Files 515 515
Lines 39120 39225 +105
==========================================
+ Hits 30951 31048 +97
- Misses 5679 5684 +5
- Partials 2490 2493 +3
Continue to review full report at Codecov.
|
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 think we still do need to test a kernel header without track
@@ -125,21 +124,6 @@ func (mods *modelSuite) TestDecodeStoreIsOptional(c *C) { | |||
c.Check(model.Store(), Equals, "") | |||
} | |||
|
|||
func (mods *modelSuite) TestDecodeKernelTrackIsOptional(c *C) { |
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.
we do need a test where KernelTrack == "", no?
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.
thank you
This also removes the "kernel-track:" key in the model assertion.
This is a minimal PR and it does not provide generic parsing for "name=channel" outside of the model assertion (because we don't support it outside yet). I can generalize the PR of course.