fix(sensor-proxy): sanitize duplicate blocks before migration
The migrate-to-file command now calls sanitizeDuplicateAllowedNodesBlocks before parsing the config, allowing it to handle corrupted configs with duplicate allowed_nodes blocks. This ensures migration works even on hosts that were affected by the original corruption issue.
This commit is contained in:
parent
c1185ebc9d
commit
0e2559a6d4
1 changed files with 3 additions and 0 deletions
|
|
@ -407,6 +407,9 @@ func migrateInlineToFile(configPath, allowedNodesPath string) error {
|
||||||
return fmt.Errorf("failed to read config: %w", err)
|
return fmt.Errorf("failed to read config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sanitize duplicate blocks before parsing
|
||||||
|
_, configData = sanitizeDuplicateAllowedNodesBlocks(configPath, configData)
|
||||||
|
|
||||||
// Parse config to extract inline nodes
|
// Parse config to extract inline nodes
|
||||||
var config map[string]interface{}
|
var config map[string]interface{}
|
||||||
if err := yaml.Unmarshal(configData, &config); err != nil {
|
if err := yaml.Unmarshal(configData, &config); err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue