summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2018-10-17 14:56:24 -0700
committerGirish Havaldar <hg0071052@techmahindra.com>2018-10-18 03:58:41 +0000
commit80e75dd7deba1dd73d6e9402ce61ed7d6e230a4e (patch)
treeb30d6919aedb5d71f538eaa3b10556b432fd6748
parent0cf377f5ff0b1daa8d0cb004ad64490cf66dd94e (diff)
Return a more helpful message for existing domain
Return a more helpful message in case you are creating a domain where it already exists. The client's behavior can be tailored based on the returned message in this case. Issue-ID: AAF-573 Change-Id: I9fdebe8f136ba09e04576214b37a76213a4ad529 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
-rw-r--r--sms-service/src/sms/backend/vault.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/sms-service/src/sms/backend/vault.go b/sms-service/src/sms/backend/vault.go
index ba3e502..a560c70 100644
--- a/sms-service/src/sms/backend/vault.go
+++ b/sms-service/src/sms/backend/vault.go
@@ -287,6 +287,10 @@ func (v *Vault) CreateSecretDomain(name string) (SecretDomain, error) {
err = v.vaultClient.Sys().Mount(mountPath, mountInput)
if smslogger.CheckError(err, "Create Domain") != nil {
+ if strings.Contains(err.Error(), "existing mount") {
+ //It is already mounted
+ return SecretDomain{}, errors.New("existing domain")
+ }
return SecretDomain{}, errors.New("Unable to create Secret Domain")
}