Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
overlord/ifacestate: fix auto-connect during core snap transition #3145
9e74cdd
d632b90
d8721bb
3a83857
b08623d
e4031b7
38c854d
e46e5e7
7b2ac56
71ce65e
2ae3055
8f0b972
93d4305
overlord/ifacestate: auto-connect core-support to core-support-plug
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
- Loading branch information...
| @@ -105,15 +105,19 @@ func (m *InterfaceManager) addSnaps() error { | ||
| // network-bind slot (on core). This cures the effects of bug | ||
| // https://bugs.launchpad.net/snappy/+bug/1680097 | ||
|
|
||
| func (m *InterfaceManager) fixDisconnectedCorePlugs() error { | ||
pedronis
Contributor
|
||
| - // If the core snap has network-bind-plug | ||
| - if m.repo.Plug("core", "network-bind-plug") != nil { | ||
| - // connect it to the slot (connect is a no-op if connected) | ||
| - connRef := interfaces.ConnRef{ | ||
| - PlugRef: interfaces.PlugRef{Snap: "core", Name: "network-bind-plug"}, | ||
| - SlotRef: interfaces.SlotRef{Snap: "core", Name: "network-bind"}, | ||
| - } | ||
| - if err := m.repo.Connect(connRef); err != nil { | ||
| - logger.Noticef("%s", err) | ||
| + const coreName = "core" | ||
| + for _, slotName := range []string{"network-bind", "core-support"} { | ||
pedronis
Contributor
|
||
| + plugName := fmt.Sprintf("%s-plug", slotName) | ||
mvo5
Collaborator
|
||
| + // If the core snap has the plug | ||
| + if m.repo.Plug(coreName, plugName) != nil { | ||
| + // connect it to the slot (connect is a no-op if connected) | ||
| + connRef := interfaces.ConnRef{ | ||
| + PlugRef: interfaces.PlugRef{Snap: coreName, Name: plugName}, | ||
| + SlotRef: interfaces.SlotRef{Snap: coreName, Name: slotName}, | ||
| + } | ||
| + if err := m.repo.Connect(connRef); err != nil { | ||
| + logger.Noticef("%s", err) | ||
| + } | ||
| } | ||
| } | ||
| return nil | ||
Kudos for the good comment and function name.