Initialize global object layer after all subsystems have initialized (#6333)

This is to ensure that object API operations are not performed
on a server on which subsystems are yet to be initialized.
This commit is contained in:
Harshavardhana
2018-08-22 23:11:17 -07:00
committed by GitHub
parent 8601f29d95
commit b01e69e08f
4 changed files with 13 additions and 21 deletions

View File

@@ -202,9 +202,9 @@ func NewConfigSys() *ConfigSys {
}
// Migrates ${HOME}/.minio/config.json to '<export_path>/.minio.sys/config/config.json'
func migrateConfigToMinioSys() error {
func migrateConfigToMinioSys(objAPI ObjectLayer) error {
// Verify if backend already has the file.
if err := checkServerConfig(context.Background(), newObjectLayerFn()); err != errConfigNotFound {
if err := checkServerConfig(context.Background(), objAPI); err != errConfigNotFound {
return err
} // if errConfigNotFound proceed to migrate..
@@ -213,7 +213,7 @@ func migrateConfigToMinioSys() error {
return err
}
return saveServerConfig(newObjectLayerFn(), config)
return saveServerConfig(objAPI, config)
}
// Initialize and load config from remote etcd or local config directory
@@ -236,7 +236,7 @@ func initConfig(objAPI ObjectLayer) error {
}
// Migrates ${HOME}/.minio/config.json to '<export_path>/.minio.sys/config/config.json'
if err := migrateConfigToMinioSys(); err != nil {
if err := migrateConfigToMinioSys(objAPI); err != nil {
return err
}
}