Skip to content

Commit

Permalink
Bugfix/2307 change error message in lakefs setup (#2435)
Browse files Browse the repository at this point in the history
* Added verification of whether the system has already been set up and changed error message when trying to initialize lakefs more than once in the UI to be descriptive
  • Loading branch information
lynnro314 committed Sep 12, 2021
1 parent ac76250 commit 56ccefd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions cmd/lakefs/cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ var setupCmd = &cobra.Command{
cloudMetadataProvider := stats.BuildMetadataProvider(logging.Default(), cfg)
metadata := stats.NewMetadata(ctx, logging.Default(), cfg.GetBlockstoreType(), metadataManager, cloudMetadataProvider)

initialized, err := metadataManager.IsInitialized(ctx)
if err != nil {
fmt.Printf("Setup failed: %s\n", err)
os.Exit(1)
}
if initialized {
fmt.Printf("Setup is already complete.\n")
os.Exit(1)
}

credentials, err := auth.CreateInitialAdminUserWithKeys(ctx, authService, metadataManager, userName, &accessKeyID, &secretAccessKey)
if err != nil {
fmt.Printf("Failed to setup admin user: %s\n", err)
Expand Down
2 changes: 1 addition & 1 deletion webui/src/lib/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ class Setup {
case 200:
return response.json();
case 409:
throw new Error('Conflict');
throw new Error('Setup is already complete.');
default:
throw new Error('Unknown');
}
Expand Down

0 comments on commit 56ccefd

Please sign in to comment.