cloudapi: make Repository.rhsm optional

I think that we can spare the users of clouadpi of writing "rhsm": "false"
into the requests so I decided to make this property optional and default
to false.

This is nice because it matches the behaviour of Weldr repositories and
sources so we can also use test/data/repositories without any changes after
openapi validation is enabled.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-03-28 16:27:30 +02:00 committed by Ondřej Budai
parent 616258ee25
commit de46e85712
4 changed files with 113 additions and 109 deletions

View file

@ -1010,7 +1010,8 @@ func collectRepos(irRepos, payloadRepositories []Repository, payloadPackageSets
func genRepoConfig(repo Repository) (*rpmmd.RepoConfig, error) {
repoConfig := new(rpmmd.RepoConfig)
repoConfig.RHSM = repo.Rhsm
repoConfig.RHSM = repo.Rhsm != nil && *repo.Rhsm
if repo.Baseurl != nil {
repoConfig.BaseURL = *repo.Baseurl