Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

fix: Support ADDLOCAL option with msi installs #32

Merged
merged 1 commit into from
Jan 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/chef/chefinstall_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

// https://docs.chef.io/install_bootstrap.html#powershell-user-data
// https://github.com/gorillalabs/go-powershell

// InstallChef will check to see if chef needs to be installed
// and if so install using the appropriate options per platform
Expand All @@ -33,7 +34,7 @@ func InstallChef() (bool, error) {
fmt.Printf("Installing chef...\n")
_, err = installMSI("C:\\Windows\\Temp\\chef-log.txt",
file,
`ADDLOCAL="ChefClientFeature,ChefSchTaskFeature,ChefPSModuleFeature"`)
`ADDLOCAL=ChefClientFeature,ChefSchTaskFeature,ChefPSModuleFeature`)
if err != nil {
fmt.Fprintf(os.Stderr, "Install failed: %v\n", err)
return false, err
Expand All @@ -50,9 +51,7 @@ func InstallChef() (bool, error) {
// string. We should then unwrap this before passing to exec
func installMSI(logFile string, msiFile string, extraArgs string) (string, error) {
cmdName := "msiexec.exe"
// TODO: extraArgs is not being passed sucessfully to cmdArgs, as such
// it is currently excluded.
cmdArgs := []string{"/qn", "/lv", logFile, "/i", msiFile}
cmdArgs := []string{"/qn", "/lv", logFile, "/i", msiFile, extraArgs}
cmd := exec.Command(cmdName, cmdArgs...)
var out bytes.Buffer
var stderr bytes.Buffer
Expand Down