fix: correct remove oci secret if secret value is empty logic

This commit is contained in:
Scott Wilson
2025-05-12 14:56:13 -07:00
parent 8d7b573988
commit 50d0035d7b
@@ -213,8 +213,8 @@ export const OCIVaultSyncFns = {
for await (const [key, variable] of Object.entries(variables)) { for await (const [key, variable] of Object.entries(variables)) {
// Only update / delete active secrets // Only update / delete active secrets
if (variable.lifecycleState === vault.models.SecretSummary.LifecycleState.Active) { if (variable.lifecycleState === vault.models.SecretSummary.LifecycleState.Active) {
if (key in secretMap) { if (key in secretMap && secretMap[key].value.length > 0) {
if (variable.value !== secretMap[key].value && secretMap[key].value.length > 0) { if (variable.value !== secretMap[key].value) {
try { try {
await updateOCIVaultVariable({ await updateOCIVaultVariable({
compartmentId: compartmentOcid, compartmentId: compartmentOcid,
@@ -230,7 +230,7 @@ export const OCIVaultSyncFns = {
}); });
} }
} }
} else if (!secretSync.syncOptions.disableSecretDeletion || !secretMap[key].value) { } else if (!secretSync.syncOptions.disableSecretDeletion) {
try { try {
await deleteOCIVaultVariable({ await deleteOCIVaultVariable({
compartmentId: compartmentOcid, compartmentId: compartmentOcid,