diff --git a/cmd/notary-server/bootstrap.go b/cmd/notary-server/bootstrap.go index 95aeee451f..c6b681cef0 100644 --- a/cmd/notary-server/bootstrap.go +++ b/cmd/notary-server/bootstrap.go @@ -9,6 +9,9 @@ import ( func bootstrap(ctx context.Context) error { s := ctx.Value("metaStore") + if s == nil { + return fmt.Errorf("no store set during bootstrapping") + } store, ok := s.(storage.Bootstrapper) if !ok { return fmt.Errorf("Store does not support bootstrapping.") diff --git a/cmd/notary-server/main.go b/cmd/notary-server/main.go index f85f640e90..62042e4df9 100644 --- a/cmd/notary-server/main.go +++ b/cmd/notary-server/main.go @@ -64,7 +64,9 @@ func main() { err = server.Run(ctx, serverConfig) } - logrus.Error(err.Error()) + if err != nil { + logrus.Fatal(err.Error()) + } return } diff --git a/migrations/rethink_migrate.sh b/migrations/rethink_migrate.sh index 93043798e7..b46b702813 100755 --- a/migrations/rethink_migrate.sh +++ b/migrations/rethink_migrate.sh @@ -10,7 +10,7 @@ echo "trying to contact RethinkDB for 30 seconds before failing" case $SERVICE_NAME in notary_server) # have to poll for DB to come up - until notary-server -config=fixtures/server-config.rethink.json -bootstrap > /dev/null + until notary-server -config=fixtures/server-config.rethink.json -bootstrap do ((iter++)) if (( iter > 30 )); then diff --git a/server/storage/tuf_store.go b/server/storage/tuf_store.go index 5826352c01..5ec2429ed1 100644 --- a/server/storage/tuf_store.go +++ b/server/storage/tuf_store.go @@ -7,6 +7,7 @@ import ( "github.com/docker/go/canonical/json" "github.com/docker/notary" + "github.com/docker/notary/storage" "github.com/docker/notary/tuf/data" ) @@ -104,3 +105,10 @@ func (tms TufMetaStorage) GetCurrent(gun, tufRole string) (*time.Time, []byte, e tms.cachedMeta[roleSha256Hex] = &storedMeta{data: roleJSON, createupdate: roleTime} return roleTime, roleJSON, nil } + +func (tms TufMetaStorage) Bootstrap() error { + if s, ok := tms.MetaStore.(storage.Bootstrapper); ok { + return s.Bootstrap() + } + return fmt.Errorf("store does not support bootstrapping") +}