X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/67daee82d7c7e3385ec252434109a3348a7c70d7..84c753c29346450bae7efd8f8bcd11aa7ea71109:/lib/config/load.go diff --git a/lib/config/load.go b/lib/config/load.go index 58747829b5..21d1722737 100644 --- a/lib/config/load.go +++ b/lib/config/load.go @@ -28,12 +28,16 @@ type Loader struct { Logger logrus.FieldLogger SkipDeprecated bool // Don't load deprecated config keys SkipLegacy bool // Don't load legacy config files + SkipAPICalls bool // Don't do checks that call RailsAPI/controller Path string KeepstorePath string KeepWebPath string CrunchDispatchSlurmPath string WebsocketPath string + KeepproxyPath string + GitHttpdPath string + KeepBalancePath string configdata []byte } @@ -64,6 +68,9 @@ func (ldr *Loader) SetupFlags(flagset *flag.FlagSet) { flagset.StringVar(&ldr.KeepWebPath, "legacy-keepweb-config", defaultKeepWebConfigPath, "Legacy keep-web configuration `file`") flagset.StringVar(&ldr.CrunchDispatchSlurmPath, "legacy-crunch-dispatch-slurm-config", defaultCrunchDispatchSlurmConfigPath, "Legacy crunch-dispatch-slurm configuration `file`") flagset.StringVar(&ldr.WebsocketPath, "legacy-ws-config", defaultWebsocketConfigPath, "Legacy arvados-ws configuration `file`") + flagset.StringVar(&ldr.KeepproxyPath, "legacy-keepproxy-config", defaultKeepproxyConfigPath, "Legacy keepproxy configuration `file`") + flagset.StringVar(&ldr.GitHttpdPath, "legacy-git-httpd-config", defaultGitHttpdConfigPath, "Legacy arv-git-httpd configuration `file`") + flagset.StringVar(&ldr.KeepBalancePath, "legacy-keepbalance-config", defaultKeepBalanceConfigPath, "Legacy keep-balance configuration `file`") flagset.BoolVar(&ldr.SkipLegacy, "skip-legacy", false, "Don't load legacy config files") } @@ -135,6 +142,18 @@ func (ldr *Loader) MungeLegacyConfigArgs(lgr logrus.FieldLogger, args []string, if legacyConfigArg != "-legacy-ws-config" { ldr.WebsocketPath = "" } + if legacyConfigArg != "-legacy-keepweb-config" { + ldr.KeepWebPath = "" + } + if legacyConfigArg != "-legacy-keepproxy-config" { + ldr.KeepproxyPath = "" + } + if legacyConfigArg != "-legacy-git-httpd-config" { + ldr.GitHttpdPath = "" + } + if legacyConfigArg != "-legacy-keepbalance-config" { + ldr.KeepBalancePath = "" + } return munged } @@ -151,12 +170,6 @@ func (ldr *Loader) loadBytes(path string) ([]byte, error) { return ioutil.ReadAll(f) } -func (ldr *Loader) LoadDefaults() (*arvados.Config, error) { - ldr.configdata = []byte(`Clusters: {zzzzz: {}}`) - defer func() { ldr.configdata = nil }() - return ldr.Load() -} - func (ldr *Loader) Load() (*arvados.Config, error) { if ldr.configdata == nil { buf, err := ldr.loadBytes(ldr.Path) @@ -237,10 +250,14 @@ func (ldr *Loader) Load() (*arvados.Config, error) { // * no primary config was loaded, and this is the // legacy config file for the current component for _, err := range []error{ + ldr.loadOldEnvironmentVariables(&cfg), ldr.loadOldKeepstoreConfig(&cfg), ldr.loadOldKeepWebConfig(&cfg), ldr.loadOldCrunchDispatchSlurmConfig(&cfg), ldr.loadOldWebsocketConfig(&cfg), + ldr.loadOldKeepproxyConfig(&cfg), + ldr.loadOldGitHttpdConfig(&cfg), + ldr.loadOldKeepBalanceConfig(&cfg), } { if err != nil { return nil, err @@ -250,9 +267,14 @@ func (ldr *Loader) Load() (*arvados.Config, error) { // Check for known mistakes for id, cc := range cfg.Clusters { - err = checkKeyConflict(fmt.Sprintf("Clusters.%s.PostgreSQL.Connection", id), cc.PostgreSQL.Connection) - if err != nil { - return nil, err + for _, err = range []error{ + checkKeyConflict(fmt.Sprintf("Clusters.%s.PostgreSQL.Connection", id), cc.PostgreSQL.Connection), + ldr.checkEmptyKeepstores(cc), + ldr.checkUnlistedKeepstores(cc), + } { + if err != nil { + return nil, err + } } } return &cfg, nil