From 851519936ddc4568fb509b263ffca706d256b7e2 Mon Sep 17 00:00:00 2001 From: guyhardonag Date: Tue, 26 Sep 2023 14:40:55 +0300 Subject: [PATCH] Use consolidated config in lakectl --- cmd/lakectl/cmd/import.go | 6 +++--- cmd/lakectl/cmd/local.go | 4 ++-- cmd/lakectl/cmd/root.go | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/lakectl/cmd/import.go b/cmd/lakectl/cmd/import.go index b5a5b10b7ae..e80942bd6ec 100644 --- a/cmd/lakectl/cmd/import.go +++ b/cmd/lakectl/cmd/import.go @@ -164,9 +164,9 @@ func newImportProgressBar(visible bool) *progressbar.ProgressBar { } func verifySourceMatchConfiguredStorage(ctx context.Context, client *apigen.ClientWithResponses, source string) { - storageConfResp, err := client.GetStorageConfigWithResponse(ctx) - DieOnErrorOrUnexpectedStatusCode(storageConfResp, err, http.StatusOK) - storageConfig := storageConfResp.JSON200 + confResp, err := client.GetConfigWithResponse(ctx) + DieOnErrorOrUnexpectedStatusCode(confResp, err, http.StatusOK) + storageConfig := confResp.JSON200.StorageConfig if storageConfig == nil { Die("Bad response from server", 1) } diff --git a/cmd/lakectl/cmd/local.go b/cmd/lakectl/cmd/local.go index c96372faa3c..dba1c53e27f 100644 --- a/cmd/lakectl/cmd/local.go +++ b/cmd/lakectl/cmd/local.go @@ -86,12 +86,12 @@ func getLocalSyncFlags(cmd *cobra.Command, client *apigen.ClientWithResponses) s presign := Must(cmd.Flags().GetBool(localPresignFlagName)) presignFlag := cmd.Flags().Lookup(localPresignFlagName) if !presignFlag.Changed { - resp, err := client.GetStorageConfigWithResponse(cmd.Context()) + resp, err := client.GetConfigWithResponse(cmd.Context()) DieOnErrorOrUnexpectedStatusCode(resp, err, http.StatusOK) if resp.JSON200 == nil { Die("Bad response from server", 1) } - presign = resp.JSON200.PreSignSupport + presign = resp.JSON200.StorageConfig.PreSignSupport } parallelism := Must(cmd.Flags().GetInt(localParallelismFlagName)) diff --git a/cmd/lakectl/cmd/root.go b/cmd/lakectl/cmd/root.go index 46b2e1dd809..0718cf26462 100644 --- a/cmd/lakectl/cmd/root.go +++ b/cmd/lakectl/cmd/root.go @@ -184,18 +184,18 @@ var rootCmd = &cobra.Command{ client := getClient() - resp, err := client.GetLakeFSVersionWithResponse(cmd.Context()) + resp, err := client.GetConfigWithResponse(cmd.Context()) if err != nil { WriteIfVerbose(getLakeFSVersionErrorTemplate, err) } else if resp.JSON200 == nil { WriteIfVerbose(getLakeFSVersionErrorTemplate, resp.Status()) } else { lakefsVersion := resp.JSON200 - info.LakeFSVersion = swag.StringValue(lakefsVersion.Version) - if swag.BoolValue(lakefsVersion.UpgradeRecommended) { - info.LakeFSLatestVersion = swag.StringValue(lakefsVersion.LatestVersion) + info.LakeFSVersion = swag.StringValue(lakefsVersion.VersionConfig.Version) + if swag.BoolValue(lakefsVersion.VersionConfig.UpgradeRecommended) { + info.LakeFSLatestVersion = swag.StringValue(lakefsVersion.VersionConfig.LatestVersion) } - upgradeURL := swag.StringValue(lakefsVersion.UpgradeUrl) + upgradeURL := swag.StringValue(lakefsVersion.VersionConfig.UpgradeUrl) if upgradeURL != "" { info.UpgradeURL = upgradeURL }