Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
interfaces: add auto-connection information to interfaces #801
Conversation
|
As discussed on IRC, I think it is fine to autoconnect network and network-bind until we work out how assertions will play into autoconnects and the UX is designed for when things are requested but not autoconnected. Looking at the patch, I'm somewhat puzzled: you are explicitly setting autoconnect to false for bool file, but assuming it is false for the other builtins (ie, you set network and network-bind to true, but don't set any of the others). For defense in depth, I think autoconnect should default to false unless specifically set to true in the interface, but I don't see where that is happening in the patch. |
|
@jdstrand this happens courtesy to go's zero-value defaults. The zero-value for |
niemeyer
reviewed
Apr 7, 2016
| @@ -133,6 +133,10 @@ type Interface interface { | ||
| // is returned when the plug cannot deal with the requested security | ||
| // system. | ||
| ConnectedSlotSnippet(plug *Plug, slot *Slot, securitySystem SecuritySystem) ([]byte, error) | ||
| + | ||
| + // AutoConnect returns true if plugs and slots should be implicitly |
niemeyer
reviewed
Apr 7, 2016
| @@ -133,6 +133,10 @@ type Interface interface { | ||
| // is returned when the plug cannot deal with the requested security | ||
| // system. | ||
| ConnectedSlotSnippet(plug *Plug, slot *Slot, securitySystem SecuritySystem) ([]byte, error) | ||
| + | ||
| + // AutoConnect returns true if plugs and slots should be implicitly | ||
| + // auto-connected when an unambiguous connection candidate is available. |
niemeyer
reviewed
Apr 7, 2016
| @@ -40,6 +40,8 @@ type TestInterface struct { | ||
| PlugSnippetCallback func(plug *Plug, slot *Slot, securitySystem SecuritySystem) ([]byte, error) | ||
| // PermanentPlugSnippetCallback is the callback invoked inside PermanentPlugSnippet() | ||
| PermanentPlugSnippetCallback func(plug *Plug, securitySystem SecuritySystem) ([]byte, error) | ||
| + // AutoConnectCallback is the callback invoked in inside AutoConnect() | ||
| + AutoConnectCallback func() bool |
|
LGTM.. just a few trivials. Please feel free to merge once these comments are in, with @jdstrand's being the second review. |
zyga commentedApr 6, 2016
This patch adds a new method to indicate if a plug / slot of a given
interface should be automatically connected.
Currently only the following interfaces are marked for auto-connection:
Other interfaces may be added later, once assertions are in place to
ensure that those are allowed for a given snap (e.g. firewall-control).
Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com