Skip to content

Commit

Permalink
Merge pull request #4039 from M0NsTeRRR/master
Browse files Browse the repository at this point in the history
fix: regression on scaleway provider in 0.14.0
  • Loading branch information
k8s-ci-robot committed Nov 21, 2023
2 parents 0e63390 + 37a8010 commit 2cc17d9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion provider/scaleway/scaleway.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,18 @@ func NewScalewayProvider(ctx context.Context, domainFilter endpoint.DomainFilter
defaultPageSize = 1000
}
}
p, _ := scw.MustLoadConfig().GetActiveProfile()

p := &scw.Profile{}
c, err := scw.LoadConfig()
if err != nil {
log.Warnf("Cannot load config: %v", err)
} else {
p, err = c.GetActiveProfile()
if err != nil {
log.Warnf("Cannot get active profile: %v", err)
}
}

scwClient, err := scw.NewClient(
scw.WithProfile(p),
scw.WithEnv(),
Expand Down
8 changes: 8 additions & 0 deletions provider/scaleway/scaleway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ func TestScalewayProvider_NewScalewayProvider(t *testing.T) {
}
}

func TestScalewayProvider_OptionnalConfigFile(t *testing.T) {
_ = os.Setenv(scw.ScwAccessKeyEnv, "SCWXXXXXXXXXXXXXXXXX")
_ = os.Setenv(scw.ScwSecretKeyEnv, "11111111-1111-1111-1111-111111111111")

_, err := NewScalewayProvider(context.TODO(), endpoint.NewDomainFilter([]string{"example.com"}), true)
assert.NoError(t, err)
}

func TestScalewayProvider_AdjustEndpoints(t *testing.T) {
provider := &ScalewayProvider{}

Expand Down

0 comments on commit 2cc17d9

Please sign in to comment.