Skip to content

Commit

Permalink
Allow bypass detecting OS
Browse files Browse the repository at this point in the history
  • Loading branch information
ratanasovvmw committed Oct 29, 2021
1 parent b4f2832 commit 14c45ed
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions agent/installer/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
uninstallFlag = flag.Bool("uninstall", false, "Unnstall a BYOH Bundle")
bundleRepoFlag = flag.String("bundleRepo", "https://projects.registry.vmware.com", "BYOH Bundle Repository. If not set, will look for bundles locally")
k8sFlag = flag.String("k8s", "1.22.1", "Kubernetes version")
osFlag = flag.String("os", "", "OS")
osFlag = flag.String("os", "", "OS. If used with install/uninstall, skip os detection")
previewOSChangesFlag = flag.Bool("previewOSChanges", false, "Preview the install and uninstall changes for the specified OS")
)

Expand Down Expand Up @@ -83,23 +83,35 @@ func detectOS() {
}

func runInstaller(install bool) {
klog.InitFlags(nil)
klogger := klogr.New()

if *bundleRepoFlag == "" {
bd := bundleDownloader{"", "."}
fmt.Printf("Bundle repo not specified. Provide bundle contents in %s\n", bd.GetBundleDirPath(*k8sFlag))
}

klog.InitFlags(nil)
klogr.New()
var i *installer
var err error
if *osFlag != "" {
// Override current OS detection
i, err = newUnchecked(*osFlag, *bundleRepoFlag, ".", klogger, &logPrinter{klogger})
if err != nil {
fmt.Println(err)
return
}
} else {
i, err = New("norepo", ".", klogger)
if err != nil {
fmt.Println(err)
return
}

i, err := New("norepo", ".", klogr.New())
if err != nil {
fmt.Println(err)
// Override preview mode
i.downloadPath = "."
i.repoAddr = *bundleRepoFlag
}

// Override preview mode
i.downloadPath = "."
i.repoAddr = *bundleRepoFlag

if install {
err = i.Install(*k8sFlag)
} else {
Expand Down

0 comments on commit 14c45ed

Please sign in to comment.