Support RHEL hosts by creating containers based on UBI

https://github.com/containers/toolbox/pull/667
This commit is contained in:
Ondřej Míchal 2021-01-07 19:57:51 +01:00 committed by Debarshi Ray
parent 6fa2184da5
commit 21d25f88e3
2 changed files with 26 additions and 0 deletions

View File

@ -7,6 +7,7 @@ __toolbox_containers() {
__toolbox_distros() {
echo "fedora"
echo "rhel"
}
__toolbox_images() {

View File

@ -101,6 +101,14 @@ var (
"f%s",
true,
},
"rhel": {
"rhel-toolbox",
"ubi",
parseReleaseRHEL,
"registry.access.redhat.com",
"ubi8",
false,
},
}
)
@ -600,6 +608,23 @@ func parseReleaseFedora(str string) (string, error) {
return release, nil
}
func parseReleaseRHEL(str string) (string, error) {
if i := strings.IndexRune(str, '.'); i == -1 {
return "", errors.New("release must have a '.'")
}
releaseN, err := strconv.ParseFloat(str, 32)
if err != nil {
return "", err
}
if releaseN <= 0 {
return "", errors.New("release must be a positive number")
}
return str, nil
}
// PathExists wraps around os.Stat providing a nice interface for checking an existence of a path.
func PathExists(path string) bool {
if _, err := os.Stat(path); !os.IsNotExist(err) {