mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
Merge pull request #14893 from Luap99/machine-proxy
podman machine: do not commit proxies into config file
This commit is contained in:
@ -240,20 +240,6 @@ func (p *Provider) LoadVMByName(name string) (machine.VM, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is here for providing the ability to propagate
|
|
||||||
// proxy settings (e.g. HTTP_PROXY and others) on a start
|
|
||||||
// and avoid a need of re-creating/re-initiating a VM
|
|
||||||
if proxyOpts := machine.GetProxyVariables(); len(proxyOpts) > 0 {
|
|
||||||
proxyStr := "name=opt/com.coreos/environment,string="
|
|
||||||
var proxies string
|
|
||||||
for k, v := range proxyOpts {
|
|
||||||
proxies = fmt.Sprintf("%s%s=\"%s\"|", proxies, k, v)
|
|
||||||
}
|
|
||||||
proxyStr = fmt.Sprintf("%s%s", proxyStr, base64.StdEncoding.EncodeToString([]byte(proxies)))
|
|
||||||
vm.CmdLine = append(vm.CmdLine, "-fw_cfg", proxyStr)
|
|
||||||
}
|
|
||||||
|
|
||||||
logrus.Debug(vm.CmdLine)
|
|
||||||
return vm, nil
|
return vm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,15 +559,29 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
|
|||||||
attr := new(os.ProcAttr)
|
attr := new(os.ProcAttr)
|
||||||
files := []*os.File{dnr, dnw, dnw, fd}
|
files := []*os.File{dnr, dnw, dnw, fd}
|
||||||
attr.Files = files
|
attr.Files = files
|
||||||
logrus.Debug(v.CmdLine)
|
|
||||||
cmdLine := v.CmdLine
|
cmdLine := v.CmdLine
|
||||||
|
|
||||||
|
// It is here for providing the ability to propagate
|
||||||
|
// proxy settings (e.g. HTTP_PROXY and others) on a start
|
||||||
|
// and avoid a need of re-creating/re-initiating a VM
|
||||||
|
if proxyOpts := machine.GetProxyVariables(); len(proxyOpts) > 0 {
|
||||||
|
proxyStr := "name=opt/com.coreos/environment,string="
|
||||||
|
var proxies string
|
||||||
|
for k, v := range proxyOpts {
|
||||||
|
proxies = fmt.Sprintf("%s%s=\"%s\"|", proxies, k, v)
|
||||||
|
}
|
||||||
|
proxyStr = fmt.Sprintf("%s%s", proxyStr, base64.StdEncoding.EncodeToString([]byte(proxies)))
|
||||||
|
cmdLine = append(cmdLine, "-fw_cfg", proxyStr)
|
||||||
|
}
|
||||||
|
|
||||||
// Disable graphic window when not in debug mode
|
// Disable graphic window when not in debug mode
|
||||||
// Done in start, so we're not suck with the debug level we used on init
|
// Done in start, so we're not suck with the debug level we used on init
|
||||||
if !logrus.IsLevelEnabled(logrus.DebugLevel) {
|
if !logrus.IsLevelEnabled(logrus.DebugLevel) {
|
||||||
cmdLine = append(cmdLine, "-display", "none")
|
cmdLine = append(cmdLine, "-display", "none")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logrus.Debugf("qemu cmd: %v", cmdLine)
|
||||||
|
|
||||||
stderrBuf := &bytes.Buffer{}
|
stderrBuf := &bytes.Buffer{}
|
||||||
|
|
||||||
cmd := &exec.Cmd{
|
cmd := &exec.Cmd{
|
||||||
|
Reference in New Issue
Block a user