Skip to content

Commit

Permalink
LoadAllRepositories: don't fail on filenames which can't be parsed
Browse files Browse the repository at this point in the history
Previously, the `LoadAllRepositories()` function used repo file filename
as the distro name, without inspecting it. Now that we parse it, the
failure to parse the filename as the distro ID string was considered an
error. This may cause osbuild-composer fail to start due to failure
while loading repositories.

Let's use the repo file filename as is as the distro name, if parsing it
fails.

Signed-off-by: Tomáš Hozza <[email protected]>
  • Loading branch information
thozza authored and achilleas-k committed Jan 25, 2024
1 parent f8b7d00 commit dadbd58
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/reporegistry/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ func LoadAllRepositories(confPaths []string) (rpmmd.DistrosRepoConfigs, error) {
// without a dot to separate major and minor release versions
distro, err := distroidparser.DefaultParser.Standardize(distroIDStr)
if err != nil {
return nil, fmt.Errorf("failed to parse distro ID string: %v", err)
log.Printf("failed to parse distro ID string, using it as is: %v", err)
// NB: Before the introduction of distro ID standardization, the filename
// was used as the distro ID. This is kept for backward compatibility
// if the filename can't be parsed.
distro = distroIDStr
}

// skip the distro repos definition, if it has been already read
Expand Down

0 comments on commit dadbd58

Please sign in to comment.