Give a machine port one holder: refuse ssh's, another module's and a doubled one, and release the assignment a given port replaces (hq ADR 0100)
This commit is contained in:
@@ -384,6 +384,20 @@ func renderingFor(ctx context.Context, open *stores, node string,
|
||||
given[m.Module] = g
|
||||
}
|
||||
}
|
||||
// And one holder per machine port across the node's modules: settings written before this was
|
||||
// refused where they are set are refused here rather than composed into two containers on
|
||||
// one port.
|
||||
holders := map[int]string{}
|
||||
for _, m := range plan.Modules {
|
||||
for _, at := range given[m.Module] {
|
||||
if other, twice := holders[at]; twice && other != m.Module {
|
||||
return catalogue.Rendering{}, inventory.Node{}, fmt.Errorf("%w: %s and %s are "+
|
||||
"both given machine port %d on %s", inventory.ErrPortTaken, other, m.Module,
|
||||
at, node)
|
||||
}
|
||||
holders[at] = m.Module
|
||||
}
|
||||
}
|
||||
|
||||
ports := map[string]map[int]int{}
|
||||
for _, m := range plan.Modules {
|
||||
|
||||
Reference in New Issue
Block a user