mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(keystone): always upload&refresh service config whenever service restart
Always upload&refresh service config whenever service restart
This commit is contained in:
@@ -124,10 +124,10 @@ func (manager *SOptionManager) DoSync(first bool) (time.Duration, error) {
|
||||
appsrv.SetExitFlag()
|
||||
}
|
||||
copyOptions(manager.options, newOpts)
|
||||
if first {
|
||||
// upload config for the first time ONLY
|
||||
manager.session.Upload()
|
||||
}
|
||||
// if first {
|
||||
// upload config
|
||||
manager.session.Upload()
|
||||
// }
|
||||
}
|
||||
return manager.refreshInterval, nil
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ type mcclientServiceConfigSession struct {
|
||||
session *mcclient.ClientSession
|
||||
serviceId string
|
||||
config *jsonutils.JSONDict
|
||||
|
||||
commonServiceId string
|
||||
}
|
||||
|
||||
func newServiceConfigSession() IServiceConfigSession {
|
||||
@@ -88,12 +90,12 @@ func (s *mcclientServiceConfigSession) Merge(opts interface{}, serviceType strin
|
||||
merged = true
|
||||
} else {
|
||||
// not initialized
|
||||
s.Upload()
|
||||
// s.Upload()
|
||||
}
|
||||
}
|
||||
commonServiceId, _ := getServiceIdByType(s.session, consts.COMMON_SERVICE, "")
|
||||
if len(commonServiceId) > 0 {
|
||||
commonConf, err := getServiceConfig(s.session, commonServiceId)
|
||||
s.commonServiceId, _ = getServiceIdByType(s.session, consts.COMMON_SERVICE, "")
|
||||
if len(s.commonServiceId) > 0 {
|
||||
commonConf, err := getServiceConfig(s.session, s.commonServiceId)
|
||||
if err != nil {
|
||||
log.Errorf("getServiceConfig for %s failed: %s", consts.COMMON_SERVICE, err)
|
||||
} else if commonConf != nil {
|
||||
@@ -123,6 +125,11 @@ func (s *mcclientServiceConfigSession) Upload() {
|
||||
// ignore the error
|
||||
log.Errorf("fail to save config: %s", err)
|
||||
}
|
||||
_, err = modules.ServicesV3.PerformAction(s.session, s.commonServiceId, "config", nconf)
|
||||
if err != nil {
|
||||
// ignore the error
|
||||
log.Errorf("fail to save common config: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user