From 9036c301b74bdeaec0a3c231356a28e4059e3a77 Mon Sep 17 00:00:00 2001 From: "Jose R. Gonzalez" Date: Fri, 26 Aug 2022 09:37:53 -0500 Subject: [PATCH] Truncate container type on pyxis update calls Signed-off-by: Jose R. Gonzalez --- certification/pyxis/pyxis.go | 7 ++++--- certification/pyxis/types.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/certification/pyxis/pyxis.go b/certification/pyxis/pyxis.go index 675c31b3..7678a5e2 100644 --- a/certification/pyxis/pyxis.go +++ b/certification/pyxis/pyxis.go @@ -299,9 +299,9 @@ func (p *pyxisClient) GetProject(ctx context.Context) (*CertProject, error) { } func (p *pyxisClient) updateProject(ctx context.Context, certProject *CertProject) (*CertProject, error) { - // We cannot send the project type to pyxis in a Patch. - // Copy the CertProject and strip the Type value to - // have omitempty skip the key in the JSON patch. + // We cannot send the project type or container type + // to pyxis in a Patch. Copy the CertProject and strip type + // values to have omitempty skip the key in the JSON patch. patchCertProject := &CertProject{ ID: certProject.ID, CertificationStatus: certProject.CertificationStatus, @@ -310,6 +310,7 @@ func (p *pyxisClient) updateProject(ctx context.Context, certProject *CertProjec ProjectStatus: certProject.ProjectStatus, // Do not copy the Type. } + patchCertProject.Container.Type = "" // Truncate this value, too. b, err := json.Marshal(patchCertProject) if err != nil { diff --git a/certification/pyxis/types.go b/certification/pyxis/types.go index 469786ba..6db02cce 100644 --- a/certification/pyxis/types.go +++ b/certification/pyxis/types.go @@ -106,8 +106,8 @@ type CertProject struct { type Container struct { DockerConfigJSON string `json:"docker_config_json,omitempty"` - Type string `json:"type" default:"Containers"` // conditionally required - ISVPID string `json:"isv_pid,omitempty"` // required + Type string `json:"type,omitempty"` // conditionally required + ISVPID string `json:"isv_pid,omitempty"` // required Registry string `json:"registry,omitempty"` Repository string `json:"repository,omitempty"` OsContentType string `json:"os_content_type,omitempty"`