fix(collect): properly set secret when overriding with flags

This commit is contained in:
Devon Bautista 2025-04-16 21:43:59 -06:00
parent b50b31ff40
commit 722345cf93
No known key found for this signature in database
GPG key ID: E1AAD3D4444A3DA0

View file

@ -87,7 +87,6 @@ var CollectCmd = &cobra.Command{
s.Password = password
}
case *secrets.LocalSecretStore:
tmpSecrets := make(map[string]string)
for k, _ := range s.Secrets {
if creds, err := bmc.GetBMCCredentials(store, k); err != nil {
log.Error().Str("id", k).Err(err).Msg("failed to get BMC credentials from secret store")
@ -102,11 +101,10 @@ var CollectCmd = &cobra.Command{
if newCreds, err := json.Marshal(creds); err != nil {
log.Error().Str("id", k).Err(err).Msg("failed to marshal updated BMC credentials")
} else {
tmpSecrets[k] = string(newCreds)
s.StoreSecretByID(k, string(newCreds))
}
}
}
store.(*secrets.LocalSecretStore).Secrets = tmpSecrets
}
}