aboutsummaryrefslogtreecommitdiffstats
path: root/src/dcm/api/logicalCloudHandler.go
diff options
context:
space:
mode:
authorIgor D.C <igor.duarte.cardoso@intel.com>2020-09-26 01:55:04 +0000
committerIgor D.C <igor.duarte.cardoso@intel.com>2020-09-26 01:56:19 +0000
commit20da89d07ad69a2cb067ceb0c416752e558bcf62 (patch)
treeccfdd709555f5c2564c296c8b37de56f394df4ac /src/dcm/api/logicalCloudHandler.go
parent8c0cc1278cc4d84863b076b2014b9bc9d8805218 (diff)
Add a couple of sanity checks in DCM
When applying, check whether logical cloud is already applied. When deleting logical cloud, check if it exists. Issue-ID: MULTICLOUD-1143 Change-Id: I6aa11d8921db76e3d9e9632f915b55fe7ab8efab Signed-off-by: Igor D.C <igor.duarte.cardoso@intel.com>
Diffstat (limited to 'src/dcm/api/logicalCloudHandler.go')
-rw-r--r--src/dcm/api/logicalCloudHandler.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dcm/api/logicalCloudHandler.go b/src/dcm/api/logicalCloudHandler.go
index 2e1811b7..fb0f0c63 100644
--- a/src/dcm/api/logicalCloudHandler.go
+++ b/src/dcm/api/logicalCloudHandler.go
@@ -186,6 +186,13 @@ func (h logicalCloudHandler) applyHandler(w http.ResponseWriter, r *http.Request
return
}
+ _, ctxVal, err := h.client.GetLogicalCloudContext(name)
+ if ctxVal != "" {
+ err = pkgerrors.New("Logical Cloud already applied")
+ http.Error(w, err.Error(), http.StatusConflict)
+ return
+ }
+
// Get Clusters
clusters, err := h.clusterClient.GetAllClusters(project, name)