fix directory permissions when using sudo

This commit is contained in:
Matthew Hooker 2017-09-15 10:48:50 -07:00
parent af1187d5e1
commit 70e493a2c2
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 9 additions and 0 deletions

View File

@ -400,6 +400,15 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri
return fmt.Errorf("Non-zero exit status.")
}
// Chmod the directory to 0777 just so that we can access it as our user
cmd = &packer.RemoteCmd{Command: p.guestCommands.Chmod(dir, "0777")}
if err := cmd.StartWithUi(comm, ui); err != nil {
return err
}
if cmd.ExitStatus != 0 {
return fmt.Errorf("Non-zero exit status. See output above for more info.")
}
return nil
}