Merge pull request #5242 from boumenot/pr-azure-docs
azure: improve docs and validation
This commit is contained in:
commit
1ed97ca938
|
@ -534,6 +534,10 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
|||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("Specify either a VHD (image_url), Image Reference (image_publisher, image_offer, image_sku) or a Managed Disk (custom_managed_disk_image_name, custom_managed_disk_resource_group_name"))
|
||||
}
|
||||
|
||||
if isImageUrl && c.ManagedImageResourceGroupName != "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed image must be created from a managed image, it cannot be created from a VHD."))
|
||||
}
|
||||
|
||||
if c.ImageUrl == "" && c.CustomManagedImageName == "" {
|
||||
if c.ImagePublisher == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_publisher must be specified"))
|
||||
|
|
|
@ -792,6 +792,26 @@ func TestConfigShouldRejectVhdAndManagedImageOutput(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// If the user specified a build of a VHD, but started with a managed image it should be rejected.
|
||||
func TestConfigShouldRejectManagedImageSourceAndVhdOutput(t *testing.T) {
|
||||
config := map[string]interface{}{
|
||||
"image_url": "ignore",
|
||||
"location": "ignore",
|
||||
"subscription_id": "ignore",
|
||||
"communicator": "none",
|
||||
"managed_image_resource_group_name": "ignore",
|
||||
"managed_image_name": "ignore",
|
||||
|
||||
// Does not matter for this test case, just pick one.
|
||||
"os_type": constants.Target_Linux,
|
||||
}
|
||||
|
||||
_, _, err := newConfig(config, getPackerConfiguration())
|
||||
if err == nil {
|
||||
t.Fatal("expected config to reject VHD and Managed Image build")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigShouldRejectCustomAndPlatformManagedImageBuild(t *testing.T) {
|
||||
config := map[string]interface{}{
|
||||
"custom_managed_image_resource_group_name": "ignore",
|
||||
|
|
|
@ -50,7 +50,10 @@ builder.
|
|||
|
||||
#### VHD or Managed Image
|
||||
|
||||
The Azure builder can create either a VHD, or a managed image. When creating a VHD the following two options are required.
|
||||
The Azure builder can create either a VHD, or a managed image. If you
|
||||
are creating a VHD, you **must** start with a VHD. Likewise, if you
|
||||
want to create a managed image you **must** start with a managed
|
||||
image. When creating a VHD the following two options are required.
|
||||
|
||||
- `capture_container_name` (string) Destination container name. Essentially the "directory" where your VHD will be
|
||||
organized in Azure. The captured VHD's URL will be https://<storage_account>.blob.core.windows.net/system/Microsoft.Compute/Images/<capture_container_name>/<capture_name_prefix>.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.vhd.
|
||||
|
|
Loading…
Reference in New Issue