This commit is contained in:
Mitchell Hashimoto 2015-06-22 12:37:52 -07:00
parent 288b9a70f6
commit 5db4d7c01f
3 changed files with 22 additions and 22 deletions

View File

@ -115,7 +115,7 @@ func (s *StepMountExtra) CleanupFunc(state multistep.StateBag) error {
}
}
}
unmountCommand, err := wrappedCommand(fmt.Sprintf("umount %s", path))
if err != nil {
return fmt.Errorf("Error creating unmount command: %s", err)

View File

@ -68,13 +68,13 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
// First define all our templatable parameters that are _required_
templates := map[string]*string{
"cluster": &p.config.Cluster,
"datacenter": &p.config.Datacenter,
"diskmode": &p.config.DiskMode,
"host": &p.config.Host,
"password": &p.config.Password,
"username": &p.config.Username,
"vm_name": &p.config.VMName,
"cluster": &p.config.Cluster,
"datacenter": &p.config.Datacenter,
"diskmode": &p.config.DiskMode,
"host": &p.config.Host,
"password": &p.config.Password,
"username": &p.config.Username,
"vm_name": &p.config.VMName,
}
for key, ptr := range templates {
if *ptr == "" {
@ -108,11 +108,11 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
}
ovftool_uri := fmt.Sprintf("vi://%s:%s@%s/%s/host/%s",
url.QueryEscape(p.config.Username),
url.QueryEscape(p.config.Password),
p.config.Host,
p.config.Datacenter,
p.config.Cluster)
url.QueryEscape(p.config.Username),
url.QueryEscape(p.config.Password),
p.config.Host,
p.config.Datacenter,
p.config.Cluster)
if p.config.ResourcePool != "" {
ovftool_uri += "/Resources/" + p.config.ResourcePool

View File

@ -113,18 +113,18 @@ func TestProvisionerSudo(t *testing.T) {
t.Fatalf("err: %s", err)
}
withSudo := p.sudo("echo hello")
if withSudo != "sudo echo hello" {
t.Fatalf("sudo command not generated correctly")
}
withSudo := p.sudo("echo hello")
if withSudo != "sudo echo hello" {
t.Fatalf("sudo command not generated correctly")
}
config["disable_sudo"] = true
config["disable_sudo"] = true
err = p.Prepare(config)
if err != nil {
t.Fatalf("err: %s", err)
}
withoutSudo := p.sudo("echo hello")
if withoutSudo != "echo hello" {
t.Fatalf("sudo-less command not generated correctly")
}
withoutSudo := p.sudo("echo hello")
if withoutSudo != "echo hello" {
t.Fatalf("sudo-less command not generated correctly")
}
}