Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sources/opensuse: Change URL path to Leap images #648

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 11 additions & 26 deletions sources/opensuse-http.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ func (s *opensuse) getPathToTarball(baseURL string, release string, arch string)
return "", fmt.Errorf("Failed to parse URL %q: %w", baseURL, err)
}

u.Path = path.Join(u.Path, "repositories", "Virtualization:", "containers:", "images:")
var tarballName string

if strings.ToLower(release) == "tumbleweed" {
u.Path = path.Join(u.Path, "openSUSE-Tumbleweed")
u.Path = path.Join(u.Path, "repositories", "Virtualization:", "containers:", "images:", "openSUSE-Tumbleweed")

switch arch {
case "i686", "x86_64":
Expand All @@ -151,34 +151,19 @@ func (s *opensuse) getPathToTarball(baseURL string, release string, arch string)
return "", fmt.Errorf("Unsupported architecture %q", arch)
}

tarballName, err := s.getTarballName(u, "tumbleweed", arch)
if err != nil {
return "", fmt.Errorf("Failed to get tarball name: %w", err)
}

u.Path = path.Join(u.Path, tarballName)
release = "tumbleweed"
} else {
u.Path = path.Join(u.Path, fmt.Sprintf("openSUSE-Leap-%s", release))

if release == "15.3" {
u.Path = path.Join(u.Path, "containers")
} else {
switch arch {
case "x86_64":
u.Path = path.Join(u.Path, "containers")
case "aarch64", "ppc64le":
u.Path = path.Join(u.Path, "containers_ports")
}
}

tarballName, err := s.getTarballName(u, "leap", arch)
if err != nil {
return "", fmt.Errorf("Failed to get tarball name: %w", err)
}
u.Path = path.Join(u.Path, "distribution", "leap", release, "appliances")
release = "leap"
}

u.Path = path.Join(u.Path, tarballName)
tarballName, err = s.getTarballName(u, release, arch)
if err != nil {
return "", fmt.Errorf("Failed to get tarball name: %w", err)
}

u.Path = path.Join(u.Path, tarballName)

return u.String(), nil
}

Expand Down