Skip to content

Commit

Permalink
reporegistry: re-export LoadAllRepositories
Browse files Browse the repository at this point in the history
This commit re-export the `LoadAllRepositories` helper. It was
unexported in osbuild#1179 but
that was a bit premature as it is still required for advanced
use-cases like osbuild/image-builder-cli#113
  • Loading branch information
mvo5 committed Feb 11, 2025
1 parent b4096d3 commit fa630cd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/reporegistry/reporegistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type RepoRegistry struct {
// Note that the confPaths must point directly to the directory with
// the json repo files.
func New(repoConfigPaths []string, repoConfigFS []fs.FS) (*RepoRegistry, error) {
repositories, err := loadAllRepositories(repoConfigPaths, repoConfigFS)
repositories, err := LoadAllRepositories(repoConfigPaths, repoConfigFS)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/reporegistry/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"github.com/osbuild/images/pkg/rpmmd"
)

// loadAllRepositories loads all repositories for given distros from the given list of paths.
// LoadAllRepositories loads all repositories for given distros from the given list of paths.
// Behavior is the same as with the LoadRepositories() method.
func loadAllRepositories(confPaths []string, confFSes []fs.FS) (rpmmd.DistrosRepoConfigs, error) {
func LoadAllRepositories(confPaths []string, confFSes []fs.FS) (rpmmd.DistrosRepoConfigs, error) {
var mergedFSes []fs.FS

for _, confPath := range confPaths {
Expand Down
4 changes: 2 additions & 2 deletions pkg/reporegistry/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func Test_LoadAllRepositories(t *testing.T) {

confPaths := getConfPaths(t)

distroReposMap, err := loadAllRepositories(confPaths, nil)
distroReposMap, err := LoadAllRepositories(confPaths, nil)
assert.NotNil(t, distroReposMap)
assert.Nil(t, err)
assert.Equal(t, len(distroReposMap), len(expectedReposMap))
Expand All @@ -307,7 +307,7 @@ func TestLoadRepositoriesLogging(t *testing.T) {
logrus.AddHook(logHook)

confPaths := getConfPaths(t)
_, err := loadAllRepositories(confPaths, nil)
_, err := LoadAllRepositories(confPaths, nil)
require.NoError(t, err)
needle := "Loaded repository configuration file: rhel-8.10.json"
assert.True(t, slices.ContainsFunc(logHook.AllEntries(), func(entry *logrus.Entry) bool {
Expand Down

0 comments on commit fa630cd

Please sign in to comment.