Skip to content

Commit

Permalink
Fixes 4943: support upload repos in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsherrill committed Nov 4, 2024
1 parent da478a2 commit 032b585
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkg/tasks/candlepin_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ func GenContentDto(repo api.RepositoryResponse) caliri.ContentDTO {
if repo.OrgID != config.RedHatOrg && repo.GpgKey != "" {
gpgKeyUrl = models.CandlepinContentGpgKeyUrl(repo.OrgID, repo.UUID)
}
url := repo.URL
if repo.Origin == config.OriginUpload {
url = repo.LatestSnapshotURL
}

return caliri.ContentDTO{
Id: &id,
Type: &repoType,
Label: &repoLabel,
Name: &repoName,
Vendor: &repoVendor,
GpgUrl: gpgKeyUrl,
ContentUrl: &repo.URL, // Set to upstream URL, but it is not used. Will use content overrides instead.
ContentUrl: &url, // Set to upstream URL, but it is not used. Will use content overrides instead.
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/tasks/update_template_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ func (t *UpdateTemplateContent) demoteContent(repoConfigUUIDs []string) error {
// Returns list of custom content to be created, a list of custom content IDs, a list of red hat content IDs, and an error.
func (t *UpdateTemplateContent) getContentList() ([]caliri.ContentDTO, []string, []string, error) {
uuids := strings.Join(t.payload.RepoConfigUUIDs, ",")
repoConfigs, _, err := t.daoReg.RepositoryConfig.List(t.ctx, t.orgId, api.PaginationData{Limit: -1}, api.FilterData{UUID: uuids, Origin: config.OriginExternal})
repoConfigs, _, err := t.daoReg.RepositoryConfig.List(t.ctx, t.orgId, api.PaginationData{Limit: -1}, api.FilterData{UUID: uuids, Origin: strings.Join([]string{config.OriginExternal, config.OriginUpload}, ",")})
if err != nil {
return nil, nil, nil, err
}
Expand Down

0 comments on commit 032b585

Please sign in to comment.