summaryrefslogtreecommitdiff
path: root/pkg/machine/fcos_amd64.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-15 10:34:32 -0400
committerGitHub <noreply@github.com>2021-09-15 10:34:32 -0400
commitfcb22e82b518bd8de31bc152b78d2cbc6ab09964 (patch)
tree137ea7311e52385c6e482b58bb70f451b313462a /pkg/machine/fcos_amd64.go
parent5e54f72a9fd119168a29c0133cac2ed36d2014b5 (diff)
parentfceec6972f07847f68847c0908fb8f03bdf7fb73 (diff)
downloadpodman-fcb22e82b518bd8de31bc152b78d2cbc6ab09964.tar.gz
podman-fcb22e82b518bd8de31bc152b78d2cbc6ab09964.tar.bz2
podman-fcb22e82b518bd8de31bc152b78d2cbc6ab09964.zip
Merge pull request #11591 from baude/v3.4aarch64backport
Use new aarch64 fcos repos
Diffstat (limited to 'pkg/machine/fcos_amd64.go')
-rw-r--r--pkg/machine/fcos_amd64.go78
1 files changed, 0 insertions, 78 deletions
diff --git a/pkg/machine/fcos_amd64.go b/pkg/machine/fcos_amd64.go
deleted file mode 100644
index 4e2e86d3e..000000000
--- a/pkg/machine/fcos_amd64.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package machine
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
-
- "github.com/coreos/stream-metadata-go/fedoracoreos"
- "github.com/coreos/stream-metadata-go/stream"
- "github.com/pkg/errors"
- "github.com/sirupsen/logrus"
-)
-
-// This should get Exported and stay put as it will apply to all fcos downloads
-// getFCOS parses fedoraCoreOS's stream and returns the image download URL and the release version
-func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) {
- var (
- fcosstable stream.Stream
- streamType string
- )
- switch imageStream {
- case "testing", "":
- streamType = fedoracoreos.StreamNext
- case "stable":
- streamType = fedoracoreos.StreamStable
- default:
- return nil, errors.Errorf("invalid stream %s: valid streams are `testing` and `stable`", imageStream)
- }
- streamurl := fedoracoreos.GetStreamURL(streamType)
- resp, err := http.Get(streamurl.String())
- if err != nil {
- return nil, err
- }
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return nil, err
- }
- defer func() {
- if err := resp.Body.Close(); err != nil {
- logrus.Error(err)
- }
- }()
-
- if err := json.Unmarshal(body, &fcosstable); err != nil {
- return nil, err
- }
- arch, ok := fcosstable.Architectures[getFcosArch()]
- if !ok {
- return nil, fmt.Errorf("unable to pull VM image: no targetArch in stream")
- }
- artifacts := arch.Artifacts
- if artifacts == nil {
- return nil, fmt.Errorf("unable to pull VM image: no artifact in stream")
- }
- qemu, ok := artifacts[artifact]
- if !ok {
- return nil, fmt.Errorf("unable to pull VM image: no qemu artifact in stream")
- }
- formats := qemu.Formats
- if formats == nil {
- return nil, fmt.Errorf("unable to pull VM image: no formats in stream")
- }
- qcow, ok := formats[Format]
- if !ok {
- return nil, fmt.Errorf("unable to pull VM image: no qcow2.xz format in stream")
- }
- disk := qcow.Disk
- if disk == nil {
- return nil, fmt.Errorf("unable to pull VM image: no disk in stream")
- }
- return &fcosDownloadInfo{
- Location: disk.Location,
- Release: qemu.Release,
- Sha256Sum: disk.Sha256,
- CompressionType: "xz",
- }, nil
-}