Do not allow different storage configurations to point to the same directory (#30169)
Replace #29171
This commit is contained in:
parent
82ffd91607
commit
6d34ce25b1
12 changed files with 75 additions and 47 deletions
|
@ -230,11 +230,14 @@ func LoadSettingsForInstall() {
|
|||
loadMailerFrom(CfgProvider)
|
||||
}
|
||||
|
||||
var uniquePaths = make(map[string]string)
|
||||
var configuredPaths = make(map[string]string)
|
||||
|
||||
func fatalDuplicatedPath(name, p string) {
|
||||
if targetName, ok := uniquePaths[p]; ok && targetName != name {
|
||||
log.Fatal("storage path %q is being used by %q and %q and all storage paths must be unique to prevent data loss.", p, targetName, name)
|
||||
func checkOverlappedPath(name, path string) {
|
||||
// TODO: some paths shouldn't overlap (storage.xxx.path), while some could (data path is the base path for storage path)
|
||||
if targetName, ok := configuredPaths[path]; ok && targetName != name {
|
||||
msg := fmt.Sprintf("Configured path %q is used by %q and %q at the same time. The paths must be unique to prevent data loss.", path, targetName, name)
|
||||
log.Error("%s", msg)
|
||||
DeprecatedWarnings = append(DeprecatedWarnings, msg)
|
||||
}
|
||||
uniquePaths[p] = name
|
||||
configuredPaths[path] = name
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue