From 438c21ff444f23de122a6eb9811fa06df3b9b804 Mon Sep 17 00:00:00 2001 From: David C Wang Date: Mon, 24 Sep 2018 18:03:23 +0000 Subject: [PATCH] Live code review fixes --- pkg/kdk/update.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/pkg/kdk/update.go b/pkg/kdk/update.go index 8e92fe0..513e9be 100644 --- a/pkg/kdk/update.go +++ b/pkg/kdk/update.go @@ -92,24 +92,14 @@ func needsUpdateConfig(cfg *KdkEnvConfig) bool { func Update(cfg *KdkEnvConfig) { if latestReleaseVersion == "" { log.Warn("Upgrade Unavailable. Unable to fetch latest version") + return } if !(needsUpdateBin() || needsUpdateImage(cfg) || needsUpdateConfig(cfg)) { log.Warn("Upgrade Unavailable. Already at latest versions") + return } - log.Info("Upgrade Available\n" + strings.Join([]string{ - "***************************************", - "The installed KDK version is out of date", - " Current: " + Version, - " Latest : " + latestReleaseVersion, - "", - "Upgrading the KDK binary, image, and config to latest version", - "", - "After upgrade, restart the the kdk with the commands:", - " kdk update", - " kdk destroy", - " kdk ssh", - "***************************************"}, "\n")) + log.Info("Upgrading KDK...\n") if needsUpdateBin() { log.Info("Updating KDK binary") @@ -153,7 +143,8 @@ func updateBin() error { if runtime.GOOS == "windows" { kdkBinName = kdkBinName + ".exe" } - kdkBinPath := filepath.Join("usr", "local", "bin", kdkBinName) + // TODO: Pass individual segments into Join + kdkBinPath := filepath.Join("/usr/local/bin", kdkBinName) // Calculate the download urls and tmp locations baseUrl := "https://github.com/cisco-sso/kdk/releases/download/" @@ -203,6 +194,7 @@ func updateBin() error { // copy bin to appropriate location binSrcPath := filepath.Join(downloadDir, kdkBinName) + // TODO: Pass individual segments into Join binDestPath := filepath.Join("/usr/local/bin", kdkBinName) // open the bin source