Fix an issue with `sudo` and `hints`

Fixes issue #2781
This commit is contained in:
Sander van Harmelen 2015-07-20 18:31:32 +02:00
parent 009dba178f
commit df909ca3ca
1 changed files with 18 additions and 1 deletions

View File

@ -71,12 +71,29 @@ func (p *Provisioner) linuxCreateConfigFiles(
return err
}
// Make sure we have enough rights to upload the hints if using sudo
if p.useSudo {
if err := p.runCommand(o, comm, "chmod 777 "+hintsDir); err != nil {
return err
}
}
if err := p.deployOhaiHints(o, comm, hintsDir); err != nil {
return err
}
// When done copying the hints restore the rights and make sure root is owner
if p.useSudo {
if err := p.runCommand(o, comm, "chmod 755 "+hintsDir); err != nil {
return err
}
if err := p.runCommand(o, comm, "chown -R root.root "+hintsDir); err != nil {
return err
}
}
}
// When done copying the files restore the rights and make sure root is owner
// When done copying all files restore the rights and make sure root is owner
if p.useSudo {
if err := p.runCommand(o, comm, "chmod 755 "+linuxConfDir); err != nil {
return err