Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate container type on pyxis update calls #775

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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