SIG as destination validation changes
This commit is contained in:
parent
0dfba0724c
commit
1438e2e449
|
@ -73,6 +73,15 @@ type SharedImageGallery struct {
|
|||
ImageVersion string `mapstructure:"image_version"`
|
||||
}
|
||||
|
||||
type SharedImageGalleryDestination struct {
|
||||
SigDestinationSubscription string `mapstructure:"subscription"`
|
||||
SigDestinationResourceGroup string `mapstructure:"resource_group"`
|
||||
SigDestinationGalleryName string `mapstructure:"gallery_name"`
|
||||
SigDestinationImageName string `mapstructure:"image_name"`
|
||||
SigDestinationImageVersion string `mapstructure:"image_version"`
|
||||
SigDestinationReplicationRegions []string `mapstructure:"replication_regions"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
common.PackerConfig `mapstructure:",squash"`
|
||||
|
||||
|
@ -86,6 +95,9 @@ type Config struct {
|
|||
// Shared Gallery
|
||||
SharedGallery SharedImageGallery `mapstructure:"shared_image_gallery"`
|
||||
|
||||
// Shared Gallery Destination
|
||||
SharedGalleryDestination SharedImageGalleryDestination `mapstructure:"shared_image_gallery_destination"`
|
||||
|
||||
// Compute
|
||||
ImagePublisher string `mapstructure:"image_publisher"`
|
||||
ImageOffer string `mapstructure:"image_offer"`
|
||||
|
@ -559,16 +571,16 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
|||
}
|
||||
} else if c.ImageUrl == "" && c.ImagePublisher == "" {
|
||||
if c.CustomManagedImageResourceGroupName == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An custom_managed_image_resource_group_name must be specified"))
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A custom_managed_image_resource_group_name must be specified"))
|
||||
}
|
||||
if c.CustomManagedImageName == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A custom_managed_image_name must be specified"))
|
||||
}
|
||||
if c.ManagedImageResourceGroupName == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An managed_image_resource_group_name must be specified"))
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed_image_resource_group_name must be specified"))
|
||||
}
|
||||
if c.ManagedImageName == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An managed_image_name must be specified"))
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed_image_name must be specified"))
|
||||
}
|
||||
} else {
|
||||
if c.ImagePublisher != "" || c.ImageOffer != "" || c.ImageSku != "" || c.ImageVersion != "" {
|
||||
|
@ -623,6 +635,24 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
|||
}
|
||||
}
|
||||
|
||||
if c.SharedGalleryDestination.SigDestinationGalleryName != "" {
|
||||
if c.SharedGalleryDestination.SigDestinationSubscription == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A subscription must be specified for shared_image_gallery_destination"))
|
||||
}
|
||||
if c.SharedGalleryDestination.SigDestinationResourceGroup == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A resource_group must be specified for shared_image_gallery_destination"))
|
||||
}
|
||||
if c.SharedGalleryDestination.SigDestinationImageName == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_name must be specified for shared_image_gallery_destination"))
|
||||
}
|
||||
if c.SharedGalleryDestination.SigDestinationImageVersion == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_version must be specified for shared_image_gallery_destination"))
|
||||
}
|
||||
if len(c.SharedGalleryDestination.SigDestinationReplicationRegions) == 0 {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A list of replication_regions must be specified for shared_image_gallery_destination"))
|
||||
}
|
||||
}
|
||||
|
||||
if c.ManagedImageOSDiskSnapshotName != "" {
|
||||
if ok, err := assertManagedImageOSDiskSnapshotName(c.ManagedImageOSDiskSnapshotName, "managed_image_os_disk_snapshot_name"); !ok {
|
||||
errs = packer.MultiErrorAppend(errs, err)
|
||||
|
|
Loading…
Reference in New Issue