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

o/devicestate,o/snapstate: move the gadget.yaml check #7906

Merged

Conversation

pedronis
Copy link
Collaborator

@pedronis pedronis commented Dec 14, 2019

Move the gadget.yaml basic check to its own checker (checkGadgetValid in devicestate.go) that will be
invoked both for install and refresh. The current placement runs it only on refreshes.

To help write the test introduce snaptest.MockContainer.

drive-by: use gadget.ReadInfoFromSnapFile in checkGadgetRemodelCompatible

@pedronis pedronis added the UC20 label Dec 14, 2019
@pedronis pedronis requested a review from mvo5 December 14, 2019 17:36
Copy link
Collaborator

@bboozzoo bboozzoo left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@stolowski stolowski left a comment

Choose a reason for hiding this comment

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

Looks good, thank you.

@@ -202,11 +203,28 @@ func checkGadgetOrKernel(st *state.State, snapInfo, curInfo *snap.Info, _ snap.C
return nil
}

func checkGadgetValid(st *state.State, snapInfo, _ *snap.Info, snapf snap.Container, flags snapstate.Flags, deviceCtx snapstate.DeviceContext) error {
if snapInfo.GetType() != snap.TypeGadget {
// not a gadget, nothing to do
Copy link
Contributor

Choose a reason for hiding this comment

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

This semantic was slightly surprising at first given the promise of the function name, but I see it's part of the general check snap callback chain, so it has to be that way.

@pedronis pedronis merged commit 6338832 into snapcore:master Dec 18, 2019
@pedronis pedronis deleted the gadget-validation-install-or-refresh branch December 18, 2019 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants