diff --git a/cmd/server/cluster_byoh.go b/cmd/server/cluster_byoh.go index 6456c79..a4e7113 100644 --- a/cmd/server/cluster_byoh.go +++ b/cmd/server/cluster_byoh.go @@ -38,7 +38,8 @@ func processClusterByoh() error { url := fmt.Sprintf("clusters/%s/nodes", clusterId) body, err := apiClient.Get(url) if err != nil { - return err + log.Error(err) + continue } var out domain.GetClusterNodesResponse @@ -55,7 +56,8 @@ func processClusterByoh() error { //completed = true // FOR TEST if completed { log.Info(fmt.Sprintf("all agents registered! starting stack creation. clusterId %s", clusterId)) - if err = clusterAccessor.UpdateClusterStatus(clusterId, domain.ClusterStatus_INSTALLING); err != nil { + // clusterId, newStatus, newMessage, workflowId + if err = clusterAccessor.UpdateClusterStatus(clusterId, domain.ClusterStatus_INSTALLING, "", ""); err != nil { log.Error("Failed to update cluster status err : ", err) continue } diff --git a/cmd/server/cluster_status.go b/cmd/server/cluster_status.go index a048f5c..4f93e52 100644 --- a/cmd/server/cluster_status.go +++ b/cmd/server/cluster_status.go @@ -83,7 +83,7 @@ func processClusterStatus() error { if status != newStatus || statusDesc != newMessage { log.Debug(fmt.Sprintf("update status!! clusterId [%s], newStatus [%s], newMessage [%s]", clusterId, newStatus, newMessage)) - err := clusterAccessor.UpdateClusterStatusWithWorkflow(clusterId, newStatus, newMessage, workflowId) + err := clusterAccessor.UpdateClusterStatus(clusterId, newStatus, newMessage, workflowId) if err != nil { log.Error("Failed to update cluster status err : ", err) continue diff --git a/internal/cluster/cluster.go b/internal/cluster/cluster.go index ec9e9a8..6bbefec 100644 --- a/internal/cluster/cluster.go +++ b/internal/cluster/cluster.go @@ -64,7 +64,7 @@ func (x *ClusterAccessor) GetBootstrappedByohClusters() ([]Cluster, error) { return clusters, nil } -func (x *ClusterAccessor) UpdateClusterStatusWithWorkflow(clusterId string, status domain.ClusterStatus, statusDesc string, workflowId string) error { +func (x *ClusterAccessor) UpdateClusterStatus(clusterId string, status domain.ClusterStatus, statusDesc string, workflowId string) error { log.Info(fmt.Sprintf("UpdateClusterStatus. clusterId[%s], status[%d], statusDesc[%s], workflowId[%s]", clusterId, status, statusDesc, workflowId)) res := x.db.Model(Cluster{}). Where("ID = ?", clusterId). @@ -75,15 +75,3 @@ func (x *ClusterAccessor) UpdateClusterStatusWithWorkflow(clusterId string, stat } return nil } - -func (x *ClusterAccessor) UpdateClusterStatus(clusterId string, status domain.ClusterStatus) error { - log.Info(fmt.Sprintf("UpdateClusterStatus. clusterId[%s], status[%d]", clusterId, status)) - res := x.db.Model(Cluster{}). - Where("ID = ?", clusterId). - Updates(map[string]interface{}{"Status": status}) - - if res.Error != nil || res.RowsAffected == 0 { - return fmt.Errorf("nothing updated in cluster with id %s", clusterId) - } - return nil -}