Skip to content

Commit

Permalink
补充错误日志
Browse files Browse the repository at this point in the history
  • Loading branch information
fusikai committed Feb 27, 2023
1 parent e97bcec commit d110717
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/pkg/service/confgov2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,23 +750,36 @@ func assemblyJunoAgent(nodes []db.AppNode) []view.JunoAgent {
}

func PublishAllConfig() (err error) {
step := ""
defer func() {
if err != nil {
xlog.Error("PublishAllConfig", zap.Error(err), zap.String("step", step))
}
}()
var configuration []db.Configuration
// todo split page
query := mysql.Where("id > 0").Order("id desc").Limit(1000).Find(&configuration)
if query.Error != nil {
step = "query.Error"
return
}
settings, err := system.System.Setting.GetAll()
clusterList := view.ClusterList{}
for _, item := range configuration {
if step != "" {
xlog.Error("PublishAllConfig.detail", zap.String("step", step))
}
var confHistory db.ConfigurationHistory
query = mysql.Where("configuration_id= ?", item.ID).Order("id desc").First(&confHistory)
if query.Error != nil {
err = query.Error
step = "confHistory.query.Error"
continue
}
var appInfo db.AppInfo
appInfo, err = resource.Resource.GetApp(item.AID)
if err != nil {
step = "resource.Resource.GetApp"
continue
}
// Save the configuration in etcd
Expand All @@ -782,12 +795,14 @@ func PublishAllConfig() (err error) {
Version: confHistory.Version,
PubK8S: true,
}); err != nil {
step = "publishETCD"
continue
}
var cp db.ConfigurationPublish
cp.ConfigurationID = item.ID
cp.ConfigurationHistoryID = confHistory.ID
if err = mysql.Save(&cp).Error; err != nil {
step = "mysql.Save.confHistory"
continue
}
_, cp.FilePath = genConfigurePath(appInfo.AppName, item.FileName())
Expand All @@ -804,6 +819,7 @@ func PublishAllConfig() (err error) {
cs.CreatedAt = time.Now()
cs.UpdateAt = time.Now()
if sErr := mysql.Save(&cs).Error; sErr != nil {
step = "mysql.Save.configurationClusterStatus"
continue
}
}
Expand Down

0 comments on commit d110717

Please sign in to comment.