From 8444cd166a02b8849962c779d406b54393387d92 Mon Sep 17 00:00:00 2001 From: Tom Dohrmann Date: Mon, 14 Oct 2024 15:23:04 +0200 Subject: [PATCH] azure: don't fill in CommunityGalleryInfo for private galleries Azure will reject any attempts to create a private gallery with the CommunityGalleryInfo filled in. --- azure/uploader.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/azure/uploader.go b/azure/uploader.go index f292daa..b5a7073 100644 --- a/azure/uploader.go +++ b/azure/uploader.go @@ -358,16 +358,20 @@ func (u *Uploader) ensureSIG(ctx context.Context) error { return nil } u.log.Printf("Creating image gallery %s in %s", sigName, rg) + var communityGalleryInfo *armcomputev5.CommunityGalleryInfo + if u.config.Azure.SharingProfile == "community" { + communityGalleryInfo = &armcomputev5.CommunityGalleryInfo{ + PublicNamePrefix: &pubNamePrefix, + Eula: toPtr("none"), + PublisherContact: toPtr("test@foo.bar"), + PublisherURI: toPtr("https://foo.bar"), + } + } gallery := armcomputev5.Gallery{ Location: &u.config.Azure.Location, Properties: &armcomputev5.GalleryProperties{ SharingProfile: &armcomputev5.SharingProfile{ - CommunityGalleryInfo: &armcomputev5.CommunityGalleryInfo{ - PublicNamePrefix: &pubNamePrefix, - Eula: toPtr("none"), - PublisherContact: toPtr("test@foo.bar"), - PublisherURI: toPtr("https://foo.bar"), - }, + CommunityGalleryInfo: communityGalleryInfo, Permissions: sharingProf, }, },