Skip to content

Commit

Permalink
chore(pkg): expose GetResolvingURLs API.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Aug 28, 2023
1 parent 20cd955 commit 835307e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/driverbuilder/builder/builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ func Script(b Builder, c Config, kr kernelrelease.KernelRelease) (string, error)
// Otherwise, it is up to the builder to return an error
if len(urls) > 0 {
// Check (and filter) existing kernels before continuing
urls, err = getResolvingURLs(urls)
urls, err = GetResolvingURLs(urls)
}
} else {
urls, err = getResolvingURLs(c.KernelUrls)
urls, err = GetResolvingURLs(c.KernelUrls)
}
if err != nil {
return "", err
Expand Down Expand Up @@ -269,7 +269,7 @@ func resolveURLReference(u string) string {
return base.ResolveReference(uu).String()
}

func getResolvingURLs(urls []string) ([]string, error) {
func GetResolvingURLs(urls []string) ([]string, error) {
var results []string
for _, u := range urls {
// in case url has some relative paths
Expand Down
2 changes: 1 addition & 1 deletion pkg/driverbuilder/builder/flatcar.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func fetchFlatcarKernelURLS(kernelVersion string) []string {
func fetchFlatcarMetadata(kr kernelrelease.KernelRelease) (*flatcarReleaseInfo, error) {
flatcarInfo := flatcarReleaseInfo{}
flatcarVersion := kr.Fullversion
packageIndexUrl, err := getResolvingURLs(fetchFlatcarPackageListURL(kr.Architecture, flatcarVersion))
packageIndexUrl, err := GetResolvingURLs(fetchFlatcarPackageListURL(kr.Architecture, flatcarVersion))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/driverbuilder/builder/opensuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (o *opensuse) URLs(kr kernelrelease.KernelRelease) ([]string, error) {
possibleURLs := buildURLs(kr, kernelDefaultDevelPattern, kernelDevelNoArchPattern)

// trim the list to only resolving URLs
urls, err := getResolvingURLs(possibleURLs)
urls, err := GetResolvingURLs(possibleURLs)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/driverbuilder/builder/ubuntu.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func ubuntuHeadersURLFromRelease(kr kernelrelease.KernelRelease, kv string) ([]s
return nil, err
}
// try resolving the URLs
urls, err := getResolvingURLs(possibleURLs)
urls, err := GetResolvingURLs(possibleURLs)
// there should be 2 urls returned - the _all.deb package and the _{arch}.deb package
if err == nil && len(urls) == ubuntuRequiredURLs {
return urls, err
Expand Down

0 comments on commit 835307e

Please sign in to comment.