Skip to content

Commit ade4f32

Browse files
flavianmissiopenshift-cherrypick-robot
authored andcommitted
cmd/move-blobs: use endpoint suffix from environment
this fixes azure government cloud, where the suffix is different.
1 parent e39fe6a commit ade4f32

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cmd/move-blobs/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,14 @@ func getConfigOpts() *configOpts {
254254
// this function is basically copy of what the operator itself does,
255255
// as a way to ensure that it will work in the same way as the operator.
256256
func getClient(cloudConfig cloud.Configuration, opts *configOpts) (*container.Client, error) {
257+
env, err := azure.EnvironmentFromName(opts.environment)
258+
if err != nil {
259+
return nil, err
260+
}
257261
containerURL := fmt.Sprintf(
258-
"https://%s.blob.core.windows.net/%s",
262+
"https://%s.blob.%s/%s",
259263
opts.storageAccountName,
264+
env.StorageEndpointSuffix,
260265
opts.containerName,
261266
)
262267
var client *container.Client

cmd/move-blobs/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ func TestMoveBlobs(t *testing.T) {
7474
defer client.DeleteBlob(ctx, opts.containerName, "/"+blobName, nil)
7575
}
7676

77+
opts.environment = "AZUREPUBLICCLOUD"
7778
cloudConfig, err := getCloudConfig(opts.environment)
7879
if err != nil {
7980
t.Fatal(err)

0 commit comments

Comments
 (0)