-
Notifications
You must be signed in to change notification settings - Fork 562
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
many: replace interfaces.Repository.AddSnap with AddAppSet #13772
base: master
Are you sure you want to change the base?
Conversation
7098b7c
to
e21b479
Compare
bd45c89
to
97b05af
Compare
8bf7bd4
to
bdaf052
Compare
d09a914
to
7a7134d
Compare
dfaa7b0
to
f33e330
Compare
4a33c39
to
47a6b55
Compare
snap/component.go
Outdated
|
||
// NewComponentInfo creates a new ComponentInfo. | ||
func NewComponentInfo(cref naming.ComponentRef, ctype ComponentType, version, summary, description string) *ComponentInfo { |
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.
Is there any specific reason to remove this function? It is not especially useful right now, but in the past we had problems with not having this sort of function to create structs and we introduced changes like a new field whose value depended partially on other fields, etc. If the struct was created directly in many tests then the changes were very time consuming and annoying.
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 used much later in “snap run” to set some environs variables
interfaces/repo.go
Outdated
@@ -1000,10 +953,12 @@ func (r *Repository) AddSnap(snapInfo *snap.Info) error { | |||
|
|||
snapName := snapInfo.InstanceName() | |||
|
|||
if r.plugs[snapName] != nil || r.slots[snapName] != nil { | |||
if r.appSets[snapName] != nil || r.plugs[snapName] != nil || r.slots[snapName] != nil { |
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.
Should be enough with checking r.appSets[snapName]
I guess? Unless AddAppSet
is not always called for all snaps.
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.
You are correct, this invariant should always hold. Would panicking be preferable in this case?
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.
Couple of comments around
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.
lgtm, doc comment question
interfaces/repo.go
Outdated
@@ -973,23 +923,26 @@ func (r *Repository) SnapSpecification(securitySystem SecuritySystem, appSet *Sn | |||
return spec, nil | |||
} | |||
|
|||
// AddSnap adds plugs and slots declared by the given snap to the repository. | |||
// AddAppSet adds plugs and slots declared by the given snap to the repository. |
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 doc comment probably need a bit more updates, as the AppSet is not strictly just about the snap anymore
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.
LGTM, thanks for the changes
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
832f38c
to
eb574d7
Compare
e0bbf2a
to
31d111d
Compare
This change will enable us to inject an app set into the interfaces.Connected(Plug|Slot) types, which will allow interfaces to correctly generate label expressions for connected plugs/slots.