mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
provider/azure: Trap a specific Platform Image error in a new PlatformStorageError
This commit is contained in:
parent
de74608d37
commit
493b31d122
5
builtin/providers/azure/errors.go
Normal file
5
builtin/providers/azure/errors.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package azure
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
var PlatformStorageError = errors.New("When using a platform image, the 'storage' parameter is required")
|
@ -591,6 +591,10 @@ func retrieveImageDetails(
|
|||||||
return configureForImage, osType, nil
|
return configureForImage, osType, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err == PlatformStorageError {
|
||||||
|
return nil, "", err
|
||||||
|
}
|
||||||
|
|
||||||
return nil, "", fmt.Errorf("Could not find image with label '%s'. Available images are: %s",
|
return nil, "", fmt.Errorf("Could not find image with label '%s'. Available images are: %s",
|
||||||
label, strings.Join(append(VMLabels, OSLabels...), ", "))
|
label, strings.Join(append(VMLabels, OSLabels...), ", "))
|
||||||
}
|
}
|
||||||
@ -647,7 +651,7 @@ func retrieveOSImageDetails(
|
|||||||
if img.MediaLink == "" {
|
if img.MediaLink == "" {
|
||||||
if storage == "" {
|
if storage == "" {
|
||||||
return nil, "", nil,
|
return nil, "", nil,
|
||||||
fmt.Errorf("When using a platform image, the 'storage' parameter is required")
|
PlatformStorageError
|
||||||
}
|
}
|
||||||
img.MediaLink = fmt.Sprintf(osDiskBlobStorageURL, storage, name)
|
img.MediaLink = fmt.Sprintf(osDiskBlobStorageURL, storage, name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user