Merge pull request #27562 from 7ing/ipt

Automatic merge from submit-queue

improve iptables-restore implementation #27559

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
fixes #27559
- improve restoreInternal implementation in iptables
- add SetStdin and SetStdout functions to Cmd interface
- modify kubelet/prober and some tests in order to work with Cmd interface
This commit is contained in:
k8s-merge-robot
2016-08-02 08:02:32 -07:00
committed by GitHub
5 changed files with 42 additions and 24 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package exec
import (
"io"
osexec "os/exec"
"syscall"
)
@@ -45,6 +46,8 @@ type Cmd interface {
// Output runs the command and returns standard output, but not standard err
Output() ([]byte, error)
SetDir(dir string)
SetStdin(in io.Reader)
SetStdout(out io.Writer)
}
// ExitError is an interface that presents an API similar to os.ProcessState, which is
@@ -82,6 +85,14 @@ func (cmd *cmdWrapper) SetDir(dir string) {
cmd.Dir = dir
}
func (cmd *cmdWrapper) SetStdin(in io.Reader) {
cmd.Stdin = in
}
func (cmd *cmdWrapper) SetStdout(out io.Writer) {
cmd.Stdout = out
}
// CombinedOutput is part of the Cmd interface.
func (cmd *cmdWrapper) CombinedOutput() ([]byte, error) {
out, err := (*osexec.Cmd)(cmd).CombinedOutput()