R-492: delete the always-empty cfg.Paths.HDDPath (field, env binding, every fallback)
Readers (report builder, health check, /api/system, web primaryHDDPath, metrics collector, AutoDiscoverStoragePaths' fallback parameter) now use the storage registry only. An old controller.yaml still carrying paths.hdd_path keeps loading (non-strict YAML), pinned by TestR492_OldConfigWithHDDPathStillLoads. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -1738,7 +1738,6 @@ func (s *Settings) SetStorageLabel(path, label string) error {
|
||||
// already in the registry. It is ADDITIVE: pre-existing entries are never removed,
|
||||
// modified, or reactivated.
|
||||
// - discoveredPaths are pre-scanned HDD_PATH values from deployed apps' app.yaml.
|
||||
// - fallbackHDDPath is the legacy controller.yaml paths.hdd_path (may be empty).
|
||||
//
|
||||
// Invariants:
|
||||
// - A path already present in the registry IN ANY STATE (including a Decommissioned
|
||||
@@ -1747,12 +1746,12 @@ func (s *Settings) SetStorageLabel(path, label string) error {
|
||||
// - IsDefault is never flipped on an existing entry. A newly-discovered path becomes
|
||||
// default ONLY if the registry currently has no default at all (and then only the
|
||||
// first such new path).
|
||||
func (s *Settings) AutoDiscoverStoragePaths(discoveredPaths []string, fallbackHDDPath string, logger *log.Logger) {
|
||||
func (s *Settings) AutoDiscoverStoragePaths(discoveredPaths []string, logger *log.Logger) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if s.debug {
|
||||
s.log.Printf("[DEBUG] [settings] AutoDiscoverStoragePaths discovered=%v fallback=%q existing=%d", discoveredPaths, fallbackHDDPath, len(s.StoragePaths))
|
||||
s.log.Printf("[DEBUG] [settings] AutoDiscoverStoragePaths discovered=%v existing=%d", discoveredPaths, len(s.StoragePaths))
|
||||
}
|
||||
|
||||
// Index existing paths (in ANY state) and whether a default already exists.
|
||||
@@ -1765,7 +1764,7 @@ func (s *Settings) AutoDiscoverStoragePaths(discoveredPaths []string, fallbackHD
|
||||
}
|
||||
}
|
||||
|
||||
// Build the de-duplicated, cleaned candidate list (discovered first, then fallback).
|
||||
// Build the de-duplicated, cleaned candidate list.
|
||||
seen := make(map[string]bool)
|
||||
var ordered []string
|
||||
for _, p := range discoveredPaths {
|
||||
@@ -1775,13 +1774,6 @@ func (s *Settings) AutoDiscoverStoragePaths(discoveredPaths []string, fallbackHD
|
||||
ordered = append(ordered, cleaned)
|
||||
}
|
||||
}
|
||||
if fallbackHDDPath != "" {
|
||||
cleaned := filepath.Clean(fallbackHDDPath)
|
||||
if cleaned != "" && cleaned != "." && !seen[cleaned] {
|
||||
seen[cleaned] = true
|
||||
ordered = append(ordered, cleaned)
|
||||
}
|
||||
}
|
||||
|
||||
added := 0
|
||||
for _, path := range ordered {
|
||||
|
||||
Reference in New Issue
Block a user