provisioner/chef: fixes #4262
This small tweak fixes #4262 by making sure files can be uploaded correctly.
This commit is contained in:
parent
82b7d8c8a0
commit
986245c553
|
@ -10,6 +10,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
chmod = "find %s -maxdepth 1 -type f -exec /bin/chmod %d {} +"
|
||||
installURL = "https://www.chef.io/chef/install.sh"
|
||||
)
|
||||
|
||||
|
@ -58,6 +59,9 @@ func (p *Provisioner) linuxCreateConfigFiles(
|
|||
if err := p.runCommand(o, comm, "chmod 777 "+linuxConfDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.runCommand(o, comm, fmt.Sprintf(chmod, linuxConfDir, 666)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := p.deployConfigFiles(o, comm, linuxConfDir); err != nil {
|
||||
|
@ -76,6 +80,9 @@ func (p *Provisioner) linuxCreateConfigFiles(
|
|||
if err := p.runCommand(o, comm, "chmod 777 "+hintsDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.runCommand(o, comm, fmt.Sprintf(chmod, hintsDir, 666)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := p.deployOhaiHints(o, comm, hintsDir); err != nil {
|
||||
|
@ -87,6 +94,9 @@ func (p *Provisioner) linuxCreateConfigFiles(
|
|||
if err := p.runCommand(o, comm, "chmod 755 "+hintsDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.runCommand(o, comm, fmt.Sprintf(chmod, hintsDir, 600)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.runCommand(o, comm, "chown -R root.root "+hintsDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -98,6 +108,9 @@ func (p *Provisioner) linuxCreateConfigFiles(
|
|||
if err := p.runCommand(o, comm, "chmod 755 "+linuxConfDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.runCommand(o, comm, fmt.Sprintf(chmod, linuxConfDir, 600)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.runCommand(o, comm, "chown -R root.root "+linuxConfDir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package chef
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
|
@ -163,14 +164,18 @@ func TestResourceProvider_linuxCreateConfigFiles(t *testing.T) {
|
|||
}),
|
||||
|
||||
Commands: map[string]bool{
|
||||
"sudo mkdir -p " + linuxConfDir: true,
|
||||
"sudo chmod 777 " + linuxConfDir: true,
|
||||
"sudo mkdir -p " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo chmod 777 " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo chmod 755 " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo chown -R root.root " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo chmod 755 " + linuxConfDir: true,
|
||||
"sudo chown -R root.root " + linuxConfDir: true,
|
||||
"sudo mkdir -p " + linuxConfDir: true,
|
||||
"sudo chmod 777 " + linuxConfDir: true,
|
||||
"sudo " + fmt.Sprintf(chmod, linuxConfDir, 666): true,
|
||||
"sudo mkdir -p " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo chmod 777 " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo " + fmt.Sprintf(chmod, path.Join(linuxConfDir, "ohai/hints"), 666): true,
|
||||
"sudo chmod 755 " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo " + fmt.Sprintf(chmod, path.Join(linuxConfDir, "ohai/hints"), 600): true,
|
||||
"sudo chown -R root.root " + path.Join(linuxConfDir, "ohai/hints"): true,
|
||||
"sudo chmod 755 " + linuxConfDir: true,
|
||||
"sudo " + fmt.Sprintf(chmod, linuxConfDir, 600): true,
|
||||
"sudo chown -R root.root " + linuxConfDir: true,
|
||||
},
|
||||
|
||||
Uploads: map[string]string{
|
||||
|
|
Loading…
Reference in New Issue