honor task user when execing into raw_exec task (#9439)

Fix #9210 .

This update the executor so it honors the User when using nomad alloc exec. The bug was that the exec task didn't honor the init command when execing.
This commit is contained in:
Mahmood Ali
2020-11-25 09:34:10 -05:00
committed by GitHub
parent c83352fde4
commit edaa16589b
6 changed files with 66 additions and 14 deletions

View File

@@ -3,6 +3,8 @@
package executor
import (
"os/exec"
hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/nomad/plugins/drivers"
)
@@ -15,8 +17,6 @@ func NewExecutorWithIsolation(logger hclog.Logger) Executor {
func (e *UniversalExecutor) configureResourceContainer(_ int) error { return nil }
func (e *UniversalExecutor) runAs(_ string) error { return nil }
func (e *UniversalExecutor) getAllPids() (map[int]*nomadPid, error) {
return getAllPidsByScanning()
}
@@ -28,3 +28,5 @@ func (e *UniversalExecutor) start(command *ExecCommand) error {
func withNetworkIsolation(f func() error, _ *drivers.NetworkIsolationSpec) error {
return f()
}
func setCmdUser(*exec.Cmd, string) error { return nil }