This repository has been archived by the owner on Jul 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RHCOSBaseURI to templating for bootstrap files
This allows us to template in the baseURI from data/data/rhcos.json when needed for boostrap files (the baremetal platform requires this to download the appropriate image to provision the masters)
- Loading branch information
Steven Hardy
committed
Jul 17, 2019
1 parent
648e9e1
commit 29bd776
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package rhcos | ||
|
||
import ( | ||
"context" | ||
"net/url" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
// BaseURI fetches the BaseURI where images can be downloaded from | ||
func BaseURI() (string, error) { | ||
meta, err := fetchRHCOSBuild(context.TODO()) | ||
if err != nil { | ||
return "", errors.Wrap(err, "failed to fetch RHCOS metadata") | ||
} | ||
|
||
base, err := url.Parse(meta.BaseURI) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return base.String(), nil | ||
} |