Skip to content

Commit 64e0c85

Browse files
authored
chore(core): remove v1 config (#2675)
1 parent 03dad56 commit 64e0c85

8 files changed

Lines changed: 7 additions & 53 deletions

File tree

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,6 @@ See more in-depth information about running the CLI in Docker [here](./docs/dock
160160
This repository is at its early stage and is still in active development.
161161
If you are looking for a way to contribute please read [CONTRIBUTING.md](./.github/CONTRIBUTING.md).
162162

163-
# Legacy version
164-
165-
If you are looking for the legacy CLIv1 you can take a look at the [v1 branch](https://github.com/scaleway/scaleway-cli/blob/v1/README.md).
166-
We also wrote [a migration guide](./docs/migration_guide_v2.md) to help transition to the CLIv2.
167-
168163
# Reach Us
169164

170165
We love feedback.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/kubernetes-client/go-base v0.0.0-20190205182333-3d0e39759d98
1919
github.com/mattn/go-colorable v0.1.13
2020
github.com/mattn/go-isatty v0.0.16
21-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221130161646-e0f8387f73a0
21+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221214161016-653cd5e743a9
2222
github.com/spf13/cobra v1.6.1
2323
github.com/spf13/pflag v1.0.5
2424
github.com/stretchr/testify v1.8.1

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
7373
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
7474
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221130161646-e0f8387f73a0 h1:pSsfbPPYDUGIeqhoIzHIMrynJPOXTPwnjiVH6sXfZ8c=
7575
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221130161646-e0f8387f73a0/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
76+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221214161016-653cd5e743a9 h1:rkMAWlN4gd7KuWvL77KLTi4Xwff6u26R9sTVIzx6554=
77+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.10.0.20221214161016-653cd5e743a9/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
7678
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
7779
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
7880
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=

internal/core/client.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ import (
1414

1515
// createClient creates a Scaleway SDK client.
1616
func createClient(ctx context.Context, httpClient *http.Client, buildInfo *BuildInfo, profileName string) (*scw.Client, error) {
17-
if _, err := scw.MigrateLegacyConfig(); err != nil {
18-
return nil, err
19-
}
20-
2117
profile := scw.LoadEnvProfile()
2218

2319
// Default path is based on the following priority order:

internal/namespaces/init/custom_init_autocomplete_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ const (
2727

2828
func Test_InitAutocomplete(t *testing.T) {
2929
defaultSettings := map[string]string{
30-
"access-key": "{{ .AccessKey }}",
31-
"secret-key": "{{ .SecretKey }}",
32-
"send-telemetry": "false",
33-
"remove-v1-config": "false",
34-
"with-ssh-key": "false",
30+
"access-key": "{{ .AccessKey }}",
31+
"secret-key": "{{ .SecretKey }}",
32+
"send-telemetry": "false",
33+
"with-ssh-key": "false",
3534
}
3635

3736
runAllShells := func(t *testing.T) {

internal/namespaces/init/custom_init_ssh_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ func Test_InitSSH(t *testing.T) {
7171
"access-key": "{{ .AccessKey }}",
7272
"secret-key": "{{ .SecretKey }}",
7373
"send-telemetry": "false",
74-
"remove-v1-config": "false",
7574
"install-autocomplete": "false",
7675
}
7776
cmds := GetCommands()

internal/namespaces/init/init.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package init
33
import (
44
"context"
55
"fmt"
6-
"os"
7-
"path"
86
"reflect"
97
"strings"
108

@@ -67,7 +65,6 @@ type initArgs struct {
6765
SendTelemetry *bool
6866
WithSSHKey *bool
6967
InstallAutocomplete *bool
70-
RemoveV1Config *bool
7168
}
7269

7370
func initCommand() *core.Command {
@@ -102,10 +99,6 @@ Default path for configuration file is based on the following priority order:
10299
Name: "install-autocomplete",
103100
Short: "Whether the autocomplete script should be installed during initialisation",
104101
},
105-
{
106-
Name: "remove-v1-config",
107-
Short: "Whether to remove the v1 configuration file if it exists",
108-
},
109102
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
110103
core.ZoneArgSpec(scw.ZoneFrPar1, scw.ZoneFrPar2, scw.ZoneNlAms1),
111104
},
@@ -229,26 +222,6 @@ Default path for configuration file is based on the following priority order:
229222
args.InstallAutocomplete = scw.BoolPtr(installAutocomplete)
230223
}
231224

232-
// Ask whether to remove v1 configuration file if it exists
233-
if args.RemoveV1Config == nil {
234-
homeDir := core.ExtractUserHomeDir(ctx)
235-
if err == nil {
236-
configPath := path.Join(homeDir, ".scwrc")
237-
if _, err := os.Stat(configPath); err == nil {
238-
removeV1ConfigFile, err := interactive.PromptBoolWithConfig(&interactive.PromptBoolConfig{
239-
Ctx: ctx,
240-
Prompt: "Do you want to permanently remove old configuration file (" + configPath + ")?",
241-
DefaultValue: false,
242-
})
243-
if err != nil {
244-
return err
245-
}
246-
247-
args.RemoveV1Config = &removeV1ConfigFile
248-
}
249-
}
250-
}
251-
252225
return nil
253226
},
254227
Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) {
@@ -328,15 +301,6 @@ Default path for configuration file is based on the following priority order:
328301
}
329302
}
330303

331-
// Remove old configuration file
332-
if args.RemoveV1Config != nil && *args.RemoveV1Config {
333-
homeDir := core.ExtractUserHomeDir(ctx)
334-
err = os.Remove(path.Join(homeDir, ".scwrc"))
335-
if err != nil {
336-
successDetails = append(successDetails, "Except for removing old configuration: "+err.Error())
337-
}
338-
}
339-
340304
_, _ = interactive.Println()
341305

342306
return &core.SuccessResult{

internal/namespaces/init/init_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ func TestInit(t *testing.T) {
4141
"secret-key": "{{ .SecretKey }}",
4242
"send-telemetry": "true",
4343
"install-autocomplete": "false",
44-
"remove-v1-config": "false",
4544
"with-ssh-key": "false",
4645
}
4746

0 commit comments

Comments
 (0)