Skip to content

Commit

Permalink
RHINENG-10240: store template arch,version
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Jun 12, 2024
1 parent 7f453d7 commit 6442e28
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions base/database/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ func DeleteSystem(t *testing.T, inventoryID string) {
func CreateTemplate(t *testing.T, account int, uuid string, inventoryIDs []string) {
template := &models.Template{
RhAccountID: account, UUID: uuid, Name: uuid, EnvironmentID: strings.ReplaceAll(uuid, "-", ""),
Arch: "x86_64", Version: "8",
}

tx := DB.Begin()
Expand Down
2 changes: 2 additions & 0 deletions base/models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ type Template struct {
UUID string
EnvironmentID string
Name string
Arch string
Version string
// Config pgtype.JSONB // currently unused
Description *string
Creator *string // pointer for compatibility with previous API versions
Expand Down
2 changes: 2 additions & 0 deletions listener/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ func TemplateUpdate(template mqueue.TemplateResponse) error {
UUID: template.UUID,
EnvironmentID: template.EnvironmentID,
Name: template.Name,
Arch: template.Arch,
Version: template.Version,
//Config: nil,
Description: template.Description,
Creator: nil,
Expand Down
8 changes: 4 additions & 4 deletions platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ var templates = []mqueue.TemplateResponse{
OrgID: "org_1",
Description: &desc1,
Arch: "x86_64",
Version: "1",
Version: "8",
Date: time.Now(),
RepositoryUUIDS: []string{"20000000-0000-0000-0000-000000000001"},
EnvironmentID: "10000000000000000000000000000001",
Expand All @@ -172,7 +172,7 @@ var templates = []mqueue.TemplateResponse{
OrgID: "org_1",
Description: &desc2,
Arch: "x86_64",
Version: "1",
Version: "8",
Date: time.Now(),
RepositoryUUIDS: []string{"20000000-0000-0000-0000-000000000001", "20000000-0000-0000-0000-000000000002"},
EnvironmentID: "10000000000000000000000000000002",
Expand Down Expand Up @@ -334,8 +334,8 @@ func mockCreatedTemplates(c *gin.Context) {

func mockUpdatedTemplates(c *gin.Context) {
updated := templates
updated[0].Version = "2"
updated[1].Version = "2"
updated[0].Version = "9"
updated[1].Version = "9"
err := sendTemplateMsg("template-updated", templates)
if err != nil {
c.JSON(http.StatusInternalServerError, err.Error())
Expand Down

0 comments on commit 6442e28

Please sign in to comment.