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/snapstate: install components and snaps from file #14095

Merged

Conversation

andrewphelpsj
Copy link
Member

@andrewphelpsj andrewphelpsj commented Jun 18, 2024

This allows us to install snaps and components from files at the same time. Based on #14092, first commit is 12afed2.

@andrewphelpsj andrewphelpsj requested review from alfonsosanchezbeato and pedronis and removed request for pedronis and alfonsosanchezbeato June 18, 2024 16:12
@andrewphelpsj andrewphelpsj force-pushed the install-component-from-file branch 4 times, most recently from 0651aa2 to fdfee01 Compare June 24, 2024 15:55
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'm not sure if the code opening the component is doing enough validation, if I look at the similar path for the snap there's more validation going on

func installableComponentsFromPaths(info *snap.Info, components map[*snap.ComponentSideInfo]string) ([]ComponentSetup, error) {
setups := make([]ComponentSetup, 0, len(components))
for csi, path := range components {
compInfo, _, err := backend.OpenComponentFile(path, info, csi)
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this do something more similar to validatedInfoFromPathAndSideInfo ?

Copy link
Member Author

@andrewphelpsj andrewphelpsj Jun 26, 2024

Choose a reason for hiding this comment

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

Yes, resolved in 88890b7.

Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

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

Some minor comments

overlord/snapstate/target.go Outdated Show resolved Hide resolved
overlord/snapstate/snapstate_install_test.go Outdated Show resolved Hide resolved
overlord/snapstate/handlers_components.go Outdated Show resolved Hide resolved
// if we're removing the snap file and we are mounting a component for the
// firs time, then we know that the component also must be coming from an
// emphemeral file. in that case, remove it.
if snapsup.RemoveSnapPath {

Choose a reason for hiding this comment

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

Maybe we should add the flags from componentInstallFlags to ComponentSetup and check that instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in fef6953.

Copy link
Collaborator

Choose a reason for hiding this comment

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

but this is code still the same? what am I missing

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, missed that in the commit.

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 for the changes, some further comments

overlord/snapstate/snapmgr.go Outdated Show resolved Hide resolved
// if we're removing the snap file and we are mounting a component for the
// firs time, then we know that the component also must be coming from an
// emphemeral file. in that case, remove it.
if snapsup.RemoveSnapPath {
Copy link
Collaborator

Choose a reason for hiding this comment

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

but this is code still the same? what am I missing

overlord/snapstate/target.go Show resolved Hide resolved
overlord/snapstate/target.go Show resolved Hide resolved
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

Copy link
Member

@alfonsosanchezbeato alfonsosanchezbeato left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the changes

@andrewphelpsj andrewphelpsj merged commit 981b979 into canonical:master Jul 2, 2024
48 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants