From 7354363c520033a6414b69e686cecb3c5cd8196a Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Mon, 30 Mar 2020 14:53:11 +0200 Subject: [PATCH] Add virtual baremetal install option Read the flag from site-config.yaml, and pass it to common.sh to indicate kni-upi-lab that it needs a virtual install. Signed-off-by: Yolanda Robla Change-Id: Ib52c5be39c56b873aa65d27e18600a04868f6b56 --- pkg/automation/baremetal.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/automation/baremetal.go b/pkg/automation/baremetal.go index 406f4c7..8a87373 100644 --- a/pkg/automation/baremetal.go +++ b/pkg/automation/baremetal.go @@ -161,14 +161,13 @@ func (bad baremetalAutomatedDeployment) PrepareAutomation(requirements map[strin if err != nil { return fmt.Errorf("baremetalAutomatedDeployment: PrepareAutomation: error unmarshalling site-config.yaml: %s", err) } + rhcosVersionsPath := fmt.Sprintf("%s/common.sh", automationDestination) if config, ok := siteConfig["config"].(map[interface{}]interface{}); ok { if releaseImageOverride, ok := config["releaseImageOverride"].(string); ok { parts := strings.Split(releaseImageOverride, ":") if len(parts) == 2 { - rhcosVersionsPath := fmt.Sprintf("%s/common.sh", automationDestination) - err = utils.ReplaceFileText(rhcosVersionsPath, "OPENSHIFT_RHCOS_MAJOR_REL=\"\"", fmt.Sprintf("OPENSHIFT_RHCOS_MAJOR_REL=\"%s\"", parts[1])) if err != nil { @@ -176,6 +175,15 @@ func (bad baremetalAutomatedDeployment) PrepareAutomation(requirements map[strin } } } + + if virtualizedInstall, ok := config["virtualizedInstall"].(string); ok { + + err = utils.ReplaceFileText(rhcosVersionsPath, "VIRTUALIZED_INSTALL=false", fmt.Sprintf("VIRTUALIZED_INSTALL=%s", virtualizedInstall)) + + if err != nil { + return fmt.Errorf("baremetalAutomatedDeployment: PrepareAutomation: error injecting virtualized install setting: %s", err) + } + } } log.Printf("baremetalAutomatedDeployment: PrepareAutomation: finished injecting version selections into automation repo\n") -- 2.16.6