provisioner/chef-client: chmod the directories
This commit is contained in:
parent
a1f1834789
commit
106c9403ed
|
@ -310,16 +310,25 @@ func (p *Provisioner) createDir(ui packer.Ui, comm packer.Communicator, dir stri
|
||||||
mkdirCmd = "sudo " + mkdirCmd
|
mkdirCmd = "sudo " + mkdirCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := &packer.RemoteCmd{
|
cmd := &packer.RemoteCmd{Command: mkdirCmd}
|
||||||
Command: mkdirCmd,
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := cmd.StartWithUi(comm, ui); err != nil {
|
if err := cmd.StartWithUi(comm, ui); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if cmd.ExitStatus != 0 {
|
if cmd.ExitStatus != 0 {
|
||||||
return fmt.Errorf("Non-zero exit status.")
|
return fmt.Errorf("Non-zero exit status. See output above for more info.")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chmod the directory to 0777 just so that we can access it as our user
|
||||||
|
mkdirCmd = fmt.Sprintf("chmod 0777 '%s'", dir)
|
||||||
|
if !p.config.PreventSudo {
|
||||||
|
mkdirCmd = "sudo " + mkdirCmd
|
||||||
|
}
|
||||||
|
cmd = &packer.RemoteCmd{Command: mkdirCmd}
|
||||||
|
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
|
return nil
|
||||||
|
|
|
@ -161,3 +161,12 @@ curl -L https://www.opscode.com/chef/install.sh | \
|
||||||
```
|
```
|
||||||
|
|
||||||
This command can be customized using the `install_command` configuration.
|
This command can be customized using the `install_command` configuration.
|
||||||
|
|
||||||
|
## Folder Permissions
|
||||||
|
|
||||||
|
The `chef-client` provisioner will chmod the directory with your Chef
|
||||||
|
keys to 777. This is to ensure that Packer can upload and make use of that
|
||||||
|
directory. However, once the machine is created, you usually don't
|
||||||
|
want to keep these directories with those permissions. To change the
|
||||||
|
permissions on the directories, append a shell provisioner after Chef
|
||||||
|
to modify them.
|
||||||
|
|
Loading…
Reference in New Issue