updated test to remove old DefaultTmpDir reference
Fixed sudo logic Fixed error message format issue for OSType check
This commit is contained in:
parent
0efda50354
commit
630b7466d6
|
@ -130,7 +130,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
|||
var ok bool
|
||||
p.guestOSTypeConfig, ok = guestOSTypeConfigs[p.config.GuestOSType]
|
||||
if !ok {
|
||||
return fmt.Errorf("Invalid guest_os_type: \"$\"", p.config.GuestOSType)
|
||||
return fmt.Errorf("Invalid guest_os_type: \"%s\"", p.config.GuestOSType)
|
||||
}
|
||||
|
||||
p.guestCommands, err = provisioner.NewGuestCommands(p.config.GuestOSType, !p.config.DisableSudo)
|
||||
|
@ -356,7 +356,7 @@ func (p *Provisioner) Cancel() {
|
|||
|
||||
// Prepends sudo to supplied command if config says to
|
||||
func (p *Provisioner) sudo(cmd string) string {
|
||||
if p.config.DisableSudo || p.config.GuestOSType != provisioner.WindowsOSType {
|
||||
if p.config.DisableSudo || (p.config.GuestOSType == provisioner.WindowsOSType) {
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package saltmasterless
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
func testConfig() map[string]interface{} {
|
||||
|
@ -31,7 +32,7 @@ func TestProvisionerPrepare_Defaults(t *testing.T) {
|
|||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if p.config.TempConfigDir != DefaultTempConfigDir {
|
||||
if p.config.TempConfigDir != p.guestOSTypeConfig.tempDir {
|
||||
t.Errorf("unexpected temp config dir: %s", p.config.TempConfigDir)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue