delete cluster key from the clusters list only when delete procedure is finished

This commit is contained in:
Murat Kabilov 2017-09-04 18:48:03 +02:00 committed by GitHub
parent 39c123e96a
commit 4db5bd13d1
1 changed files with 5 additions and 5 deletions

View File

@ -200,6 +200,11 @@ func (c *Controller) processEvent(event spec.ClusterEvent) {
lg.Infoln("deletion of the cluster started") lg.Infoln("deletion of the cluster started")
teamName := strings.ToLower(cl.Spec.TeamID) teamName := strings.ToLower(cl.Spec.TeamID)
if err := cl.Delete(); err != nil {
lg.Errorf("could not delete cluster: %v", err)
}
func() { func() {
defer c.clustersMu.Unlock() defer c.clustersMu.Unlock()
c.clustersMu.Lock() c.clustersMu.Lock()
@ -216,11 +221,6 @@ func (c *Controller) processEvent(event spec.ClusterEvent) {
} }
}() }()
if err := cl.Delete(); err != nil {
lg.Errorf("could not delete cluster: %v", err)
return
}
lg.Infof("cluster has been deleted") lg.Infof("cluster has been deleted")
case spec.EventSync: case spec.EventSync:
lg.Infof("syncing of the cluster started") lg.Infof("syncing of the cluster started")