1
0
mirror of https://github.com/distribution/distribution synced 2024-11-06 19:35:52 +01:00

Merge pull request #2115 from yixizhang/health

Use app.driver.Stat for registry health check
This commit is contained in:
Derek McGowan 2017-01-03 12:50:18 -08:00 committed by GitHub
commit 76f514b618
2 changed files with 2 additions and 2 deletions

@ -345,7 +345,7 @@ func (app *App) RegisterHealthChecks(healthRegistries ...*health.Registry) {
}
storageDriverCheck := func() error {
_, err := app.driver.List(app, "/") // "/" should always exist
_, err := app.driver.Stat(app, "/") // "/" should always exist
return err // any error will be treated as failure
}

@ -137,7 +137,7 @@ func (base *Base) Stat(ctx context.Context, path string) (storagedriver.FileInfo
ctx, done := context.WithTrace(ctx)
defer done("%s.Stat(%q)", base.Name(), path)
if !storagedriver.PathRegexp.MatchString(path) {
if !storagedriver.PathRegexp.MatchString(path) && path != "/" {
return nil, storagedriver.InvalidPathError{Path: path, DriverName: base.StorageDriver.Name()}
}