diff options
author | Ashley Cui <acui@redhat.com> | 2021-08-12 10:31:17 -0400 |
---|---|---|
committer | Ashley Cui <acui@redhat.com> | 2021-08-24 14:18:55 -0400 |
commit | 3f22e529644aad8e4b763564c9ef98a3cbdae4fc (patch) | |
tree | 0cd4b9b69d955bb5e726417f0c31879784290a5b /pkg/machine/fcos_amd64.go | |
parent | 23f9565547ae2a6b0154e6913abf7f1232f0ece0 (diff) | |
download | podman-3f22e529644aad8e4b763564c9ef98a3cbdae4fc.tar.gz podman-3f22e529644aad8e4b763564c9ef98a3cbdae4fc.tar.bz2 podman-3f22e529644aad8e4b763564c9ef98a3cbdae4fc.zip |
Allow setting of machine stream and image path from containers.conf
Default is "testing"
Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'pkg/machine/fcos_amd64.go')
-rw-r--r-- | pkg/machine/fcos_amd64.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/machine/fcos_amd64.go b/pkg/machine/fcos_amd64.go index 36676405a..4e2e86d3e 100644 --- a/pkg/machine/fcos_amd64.go +++ b/pkg/machine/fcos_amd64.go @@ -8,16 +8,26 @@ import ( "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() (*fcosDownloadInfo, error) { +func getFCOSDownload(imageStream string) (*fcosDownloadInfo, error) { var ( fcosstable stream.Stream + streamType string ) - streamurl := fedoracoreos.GetStreamURL(fedoracoreos.StreamNext) + 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 |