Skip to content

Commit

Permalink
Validate repo adapter type from config (#8632)
Browse files Browse the repository at this point in the history
  • Loading branch information
itaigilo authored Feb 9, 2025
1 parent 3338af2 commit 83bb605
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/lakefs/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ var runCmd = &cobra.Command{
logger.WithError(err).Fatal(mismatchedReposFlagName)
}
if !allowForeign {
checkRepos(ctx, logger, authMetadataManager, blockStore, c)
checkRepos(ctx, logger, cfg, authMetadataManager, blockStore, c)
}

// update health info with installation ID
Expand Down Expand Up @@ -421,7 +421,7 @@ var runCmd = &cobra.Command{
}

// checkRepos iterating on all repos and validates that their settings are correct.
func checkRepos(ctx context.Context, logger logging.Logger, authMetadataManager auth.MetadataManager, blockStore block.Adapter, c *catalog.Catalog) {
func checkRepos(ctx context.Context, logger logging.Logger, config config.Config, authMetadataManager auth.MetadataManager, blockStore block.Adapter, c *catalog.Catalog) {
initialized, err := authMetadataManager.IsInitialized(ctx)
if err != nil {
logger.WithError(err).Fatal("Failed to check if lakeFS is initialized")
Expand All @@ -443,8 +443,9 @@ func checkRepos(ctx context.Context, logger logging.Logger, authMetadataManager
logger.WithError(err).Fatal("Checking existing repositories failed")
}

adapterStorageType := blockStore.BlockstoreType()
for _, repo := range repos {
adapterConfig := config.StorageConfig().GetStorageByID(repo.StorageID)
adapterStorageType := adapterConfig.BlockstoreType()
nsURL, err := url.Parse(repo.StorageNamespace)
if err != nil {
logger.WithError(err).Fatalf("Failed to parse repository %s namespace '%s'", repo.Name, repo.StorageNamespace)
Expand Down

0 comments on commit 83bb605

Please sign in to comment.