Skip to content

Commit

Permalink
composer: don't create RepoRegistry using reporegistry.New()
Browse files Browse the repository at this point in the history
The `reporegistry.New()` has been enhanced to return an error, in case
there were no repositories loaded. This was to fix the situation in many
unit tests, which were previously not loading any repositories and
silently not running any tests.

This however broke our SaaS deployment, where we actually do not
configure any repositories on the filesystem. As a result,
osbuild-composer started to fail on it.

Workaround this situation in osbuild-composer by reverting to the old
behavior by loading the repo configs separately and then using the
loaded repos (which could be empty map) to initialize the RepoRegistry.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
  • Loading branch information
thozza committed Sep 23, 2024
1 parent f001c05 commit 4d87212
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/osbuild-composer/composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ func NewComposer(config *ComposerConfigFile, stateDir, cacheDir string) (*Compos
return nil, fmt.Errorf("failed to configure distro aliases: %v", err)
}

c.repos, err = reporegistry.New(repositoryConfigs)
repoConfigs, err := reporegistry.LoadAllRepositories(repositoryConfigs)
if err != nil {
return nil, fmt.Errorf("error loading repository definitions: %v", err)
}
c.repos = reporegistry.NewFromDistrosRepoConfigs(repoConfigs)

c.solver = dnfjson.NewBaseSolver(path.Join(c.cacheDir, "rpmmd"))
c.solver.SetDNFJSONPath(c.config.DNFJson)
Expand Down

0 comments on commit 4d87212

Please sign in to comment.