@pedronis Iām currently considering something along those lines:
diff --git a/overlord/ifacestate/helpers.go b/overlord/ifacestate/helpers.go
index 511e17e..a9b4222 100644
--- a/overlord/ifacestate/helpers.go
+++ b/overlord/ifacestate/helpers.go
@@ -93,16 +93,6 @@ func (m *InterfaceManager) addSnaps() error {
return err
}
for _, snapInfo := range snaps {
- if snapInfo.Name() == "core" {
- // Some released core snaps had explicitly defined plugs
- // "network-bind" and "core-support" that clashed with implicit
- // slots with the same names but this was not validated before. To
- // avoid a flag day and any potential issues, transparently rename
- // the two clashing plugs by appending the "-plug" suffix.
- for _, plugName := range []string{"network-bind", "core-support"} {
- snapInfo.RenamePlug(plugName, plugName+"-plug")
- }
- }
snap.AddImplicitSlots(snapInfo)
if err := m.repo.AddSnap(snapInfo); err != nil {
logger.Noticef("%s", err)
diff --git a/overlord/snapstate/snapmgr.go b/overlord/snapstate/snapmgr.go
index ed54e01..ba70026 100644
--- a/overlord/snapstate/snapmgr.go
+++ b/overlord/snapstate/snapmgr.go
@@ -248,6 +248,7 @@ func readInfoAnyway(name string, si *snap.SideInfo) (*snap.Info, error) {
}
return info, nil
}
+ info.RenameClashingCorePlugs()
return info, err
}
diff --git a/snap/broken.go b/snap/broken.go
index 52ebede..8f2b10a 100644
--- a/snap/broken.go
+++ b/snap/broken.go
@@ -62,3 +62,17 @@ func GuessAppsForBroken(info *Info) map[string]*AppInfo {
return out
}
+
+// RenameClashingCorePlugs renames plugs that clash with slot names on core snap.
+//
+// Some released core snaps had explicitly defined plugs "network-bind" and
+// "core-support" that clashed with implicit slots with the same names but this
+// was not validated before. To avoid a flag day and any potential issues,
+// transparently rename the two clashing plugs by appending the "-plug" suffix.
+func (info *Info) RenameClashingCorePlugs() {
+ if info.Name() == "core" {
+ for _, plugName := range []string{"network-bind", "core-support"} {
+ info.RenamePlug(plugName, plugName+"-plug")
+ }
+ }
+}
This is on top of my rename-clashing-core-plugs branch which lives in this PR: https://github.com/snapcore/snapd/pull/3154