You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OCPBUGS-22840: ic/azure: validate field Plan when for marketplace images
If you try to deploy a cluster with a marketplace image that requires a
purchase plan to be accepted but set it to `NoPurchasePlan` in the
install-config, the VM provisioning will fail with:
```
ERROR Error: waiting for creation of Linux Virtual Machine: (Name "jima02test-7jf8d-bootstrap" / Resource Group "jima02test-7jf8d-rg"): Code="VMMarketplaceInvalidInput" Message="Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request. VM: '/subscriptions/$ID/resourceGroups/jima02test-7jf8d-rg/providers/Microsoft.Compute/virtualMachines/jima02test-7jf8d-bootstrap'."
```
Let's check if the `Plan` field actually matches what's expected based
on the image's plan properties.
returnfield.Invalid(osImageFieldPath, osImage, fmt.Sprintf("could not determine if the license terms for the marketplace image have been accepted: %v", err))
830
+
// Image has license terms to be accepted
831
+
osImagePlan:=osImage.Plan
832
+
iflen(osImagePlan) ==0 {
833
+
// Use the default if not set in the install-config
834
+
osImagePlan=aztypes.ImageWithPurchasePlan
838
835
}
839
-
if!termsAccepted {
840
-
returnfield.Invalid(osImageFieldPath, osImage, "the license terms for the marketplace image have not been accepted")
836
+
ifplan:=vmImage.Plan; plan!=nil {
837
+
ifosImagePlan==aztypes.ImageNoPurchasePlan {
838
+
returnfield.Invalid(osImageFieldPath, osImage, "marketplace image requires license terms to be accepted")
returnfield.Invalid(osImageFieldPath, osImage, fmt.Sprintf("could not determine if the license terms for the marketplace image have been accepted: %v", err))
843
+
}
844
+
if!termsAccepted {
845
+
returnfield.Invalid(osImageFieldPath, osImage, "the license terms for the marketplace image have not been accepted")
0 commit comments