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

asserts,image: add support for new kernel=track syntax #5563

Merged
merged 5 commits into from Jul 30, 2018

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Jul 26, 2018

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.

This also removes the "kernel-track:" key in the model assertion.
@mvo5 mvo5 added the Core18 label Jul 26, 2018
Copy link
Collaborator

@pedronis pedronis left a 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]
Copy link
Collaborator

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-io
Copy link

codecov-io commented Jul 27, 2018

Codecov Report

Merging #5563 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
image/image.go 72.34% <ø> (-0.99%) ⬇️
asserts/device_asserts.go 98.24% <100%> (-0.79%) ⬇️
interfaces/apparmor/backend.go 80.71% <0%> (+3.39%) ⬆️
interfaces/apparmor/apparmor.go 98.38% <0%> (+3.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b8733a7...682bfff. Read the comment docs.

Copy link
Collaborator

@pedronis pedronis left a 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) {
Copy link
Collaborator

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?

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@mvo5 mvo5 merged commit 3b195ca into snapcore:master Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants