Add virtual baremetal install option 10/3310/2
authorYolanda Robla <yroblamo@redhat.com>
Mon, 30 Mar 2020 12:53:11 +0000 (14:53 +0200)
committerYolanda Robla <yroblamo@redhat.com>
Wed, 1 Apr 2020 10:20:35 +0000 (12:20 +0200)
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 <yroblamo@redhat.com>
Change-Id: Ib52c5be39c56b873aa65d27e18600a04868f6b56

pkg/automation/baremetal.go

index 406f4c7..8a87373 100644 (file)
@@ -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")