rpmmd: fix LoadRepositories in case no valid path is provided

The LoadRepositories function interates over a list of paths and expects
to find a distro configuration in one of them. The case when no path
with valid configuration is found was not handled. This patch introduces
the check.
This commit is contained in:
Martin Sehnoutka 2020-02-24 10:21:29 +01:00 committed by Tom Gundersen
parent 0a4ce9dc68
commit 1e2ef9ada1

View file

@ -136,6 +136,9 @@ func LoadRepositories(confPaths []string, distro string) (map[string][]RepoConfi
return nil, err
}
}
if err != nil {
return nil, &RepositoryError{"LoadRepositories failed: none of the provided paths contain distro configuration"}
}
defer f.Close()
var repos map[string][]RepoConfig