cmd/plume: Validate Azure VHD only once
@@ -206,21 +206,6 @@ func azurePreRelease(ctx context.Context, client *http.Client, src *storage.Buck
return fmt.Errorf("failed reading Azure profile: %v", err)
}
- for _, opt := range prof.AsOptions() {
- // construct azure api client
- plog.Printf("Creating Azure API from subscription %q endpoint %q", opt.SubscriptionID, opt.ManagementURL)
- api, err := azure.New(&opt)
- if err != nil {
- return fmt.Errorf("failed to create Azure API: %v", err)
- }
-
- plog.Printf("Fetching Azure storage credentials")
-
- storageKey, err := api.GetStorageServiceKeys(spec.Azure.StorageAccount)
- if err != nil {
- return err
- }
-
// download azure vhd image and unzip it
vhdfile, err := getImageFile(client, src, spec.Azure.Image)
if err != nil {
@@ -232,11 +217,25 @@ func azurePreRelease(ctx context.Context, client *http.Client, src *storage.Buck
if err := validator.ValidateVhd(vhdfile); err != nil {
return err
}
-
if err := validator.ValidateVhdSize(vhdfile); err != nil {
return err
}
+ for _, opt := range prof.AsOptions() {
+ // construct azure api client
+ plog.Printf("Creating Azure API from subscription %q endpoint %q", opt.SubscriptionID, opt.ManagementURL)
+ api, err := azure.New(&opt)
+ if err != nil {
+ return fmt.Errorf("failed to create Azure API: %v", err)
+ }
+
+ plog.Printf("Fetching Azure storage credentials")
+
+ storageKey, err := api.GetStorageServiceKeys(spec.Azure.StorageAccount)
+ if err != nil {
+ return err
+ }
+
// upload blob, do not overwrite
plog.Printf("Uploading %q to Azure Storage...", vhdfile)
