Skip unlocker directories with missing metadata instead of failing (closes #1) #17
@@ -58,6 +58,16 @@ func IsDebugEnabled() bool {
|
|||||||
return debugEnabled
|
return debugEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warn logs a warning message to stderr unconditionally (visible without --verbose or debug flags)
|
||||||
|
func Warn(msg string, args ...any) {
|
||||||
|
output := fmt.Sprintf("WARNING: %s", msg)
|
||||||
|
for i := 0; i+1 < len(args); i += 2 {
|
||||||
|
output += fmt.Sprintf(" %s=%v", args[i], args[i+1])
|
||||||
|
}
|
||||||
|
output += "\n"
|
||||||
|
fmt.Fprint(os.Stderr, output)
|
||||||
|
}
|
||||||
|
|
||||||
// Debug logs a debug message with optional attributes
|
// Debug logs a debug message with optional attributes
|
||||||
func Debug(msg string, args ...any) {
|
func Debug(msg string, args ...any) {
|
||||||
if !debugEnabled {
|
if !debugEnabled {
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ func (v *Vault) ListUnlockers() ([]UnlockerMetadata, error) {
|
|||||||
return nil, fmt.Errorf("failed to check if metadata exists for unlocker %s: %w", file.Name(), err)
|
return nil, fmt.Errorf("failed to check if metadata exists for unlocker %s: %w", file.Name(), err)
|
||||||
}
|
}
|
||||||
if !exists {
|
if !exists {
|
||||||
secret.Debug("Skipping unlocker directory with missing metadata file", "directory", file.Name())
|
secret.Warn("Skipping unlocker directory with missing metadata file", "directory", file.Name())
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user