Test the resolver file as the uplink's, and refuse a second writer of a fact's path (hq ADR 0223)
The catalogue moves /etc/resolv.conf from resolv-conf to the three uplink modules. A rendered fact was not compared with other modules' paths, so two modules could each write the resolver file on one machine, the last winning every apply; a fact's path now counts as its module's.
This commit is contained in:
@@ -939,6 +939,23 @@ func checkResources(modules []Manifest) []string {
|
||||
}
|
||||
}
|
||||
}
|
||||
// **A file the mesh renders for a module is that module's path too** (novox/hq ADR 0223). The
|
||||
// machine's resolver file is a fact the uplink's holder asks for, and a second module asking
|
||||
// for it, or declaring it, would have the host write one path twice in every apply, the last
|
||||
// one winning. A fact under the operator's home is placed per account and compared nowhere.
|
||||
for _, name := range sortedFacts(m.Facts) {
|
||||
fact := m.Facts[name]
|
||||
if fact.Home || !strings.HasPrefix(fact.Path, "/") {
|
||||
continue
|
||||
}
|
||||
key := "path " + fact.Path
|
||||
if other, taken := owner[key]; taken && other != m.Module {
|
||||
problems = append(problems, fmt.Sprintf(
|
||||
"%s and %s both declare the path %q", other, m.Module, fact.Path))
|
||||
}
|
||||
owner[key] = m.Module
|
||||
ownedPath[fact.Path] = m.Module
|
||||
}
|
||||
}
|
||||
|
||||
// An accessed path is the operator's, so no module may declare it as one of its own
|
||||
|
||||
Reference in New Issue
Block a user