From dde1a91f295fc034245be12bb116d5c8ccd6e7ef Mon Sep 17 00:00:00 2001 From: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> Date: Fri, 25 Oct 2024 18:43:23 +0100 Subject: [PATCH] fix: Clear any existing properties for a secret before creating/updating it in etcd Signed-off-by: Eamonn Mansour <47121388+eamansour@users.noreply.github.com> --- .../dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java b/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java index 181a3ab..cf13ef8 100644 --- a/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java +++ b/galasa-extensions-parent/dev.galasa.cps.etcd/src/main/java/dev/galasa/cps/etcd/internal/Etcd3CredentialsStore.java @@ -120,6 +120,9 @@ public void setCredentials(String credentialsId, ICredentials credentials) throw Properties credentialProperties = credentials.toProperties(credentialsId); try { + // Clear any existing properties with the same credentials ID + deleteCredentials(credentialsId); + for (Entry property : credentialProperties.entrySet()) { put((String) property.getKey(), encryptionService.encrypt((String) property.getValue())); }