provider/azure: Trap a specific Platform Image error in a new PlatformStorageError

This commit is contained in:
Clint Shryock 2015-07-27 10:23:42 -05:00
parent de74608d37
commit 493b31d122
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,5 @@
package azure
import "errors"
var PlatformStorageError = errors.New("When using a platform image, the 'storage' parameter is required")

View File

@ -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)
} }