fix daemon scheduler option validate bug
@@ -38,7 +38,6 @@ import (
"d7y.io/dragonfly/v2/internal/dfnet"
"d7y.io/dragonfly/v2/pkg/unit"
"d7y.io/dragonfly/v2/pkg/util/net/iputils"
- "d7y.io/dragonfly/v2/pkg/util/stringutils"
)
type DaemonConfig = DaemonOption
@@ -63,7 +62,6 @@ type DaemonOption struct {
Proxy *ProxyOption `mapstructure:"proxy" yaml:"proxy"`
Upload UploadOption `mapstructure:"upload" yaml:"upload"`
Storage StorageOption `mapstructure:"storage" yaml:"storage"`
- ConfigServer string `mapstructure:"configServer" yaml:"configServer"`
Health *HealthOption `mapstructure:"health" yaml:"health"`
// TODO WIP, did not use
Reload ReloadOption `mapstructure:"reloadOption" yaml:"reloadOption"`
@@ -115,20 +113,19 @@ func (p *DaemonOption) Convert() error {
}
func (p *DaemonOption) Validate() error {
- if len(p.Scheduler.NetAddrs) == 0 && stringutils.IsBlank(p.ConfigServer) {
- return errors.New("empty schedulers and config server is not specified")
- }
-
if p.Scheduler.Manager.Enable {
- if len(p.Scheduler.NetAddrs) == 0 {
+ if len(p.Scheduler.Manager.NetAddrs) == 0 {
return errors.New("manager addr is not specified")
}
if p.Scheduler.Manager.RefreshInterval == 0 {
return errors.New("manager refreshInterval is not specified")
}
+ return nil
+ }
+ if len(p.Scheduler.NetAddrs) == 0 {
+ return errors.New("empty schedulers and config server is not specified")
}
-
return nil
}
