Skip to content

Commit

Permalink
Truncate container type on pyxis update calls
Browse files Browse the repository at this point in the history
Signed-off-by: Jose R. Gonzalez <jose@flutes.dev>
  • Loading branch information
komish committed Aug 26, 2022
1 parent 5f4cc98 commit 243b88b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions certification/pyxis/pyxis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions certification/pyxis/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 243b88b

Please sign in to comment.