From 3dfc8bf7f3360ad34209eb44bb7fa532c6954eff Mon Sep 17 00:00:00 2001 From: ymqytw Date: Tue, 18 Jul 2017 22:58:53 -0700 Subject: [PATCH 1/3] update import --- cmd/kube-proxy/app/server.go | 2 +- cmd/kubemark/hollow-node.go | 2 +- .../providers/openstack/metadata.go | 2 +- pkg/kubectl/cmd/run.go | 2 +- pkg/kubectl/cmd/util/helpers.go | 2 +- pkg/kubectl/cmd/util/helpers_test.go | 4 +- pkg/kubelet/dockershim/exec.go | 2 +- .../dockershim/remote/docker_service.go | 2 +- pkg/kubelet/kubelet.go | 2 +- pkg/kubelet/network/cni/cni.go | 2 +- pkg/kubelet/network/cni/cni_test.go | 13 +- pkg/kubelet/network/hairpin/hairpin.go | 2 +- pkg/kubelet/network/hairpin/hairpin_test.go | 13 +- pkg/kubelet/network/kubenet/kubenet_linux.go | 2 +- .../network/kubenet/kubenet_linux_test.go | 31 +- pkg/kubelet/network/plugins.go | 2 +- pkg/kubelet/prober/common_test.go | 2 +- pkg/kubelet/prober/prober.go | 2 +- pkg/kubelet/prober/worker_test.go | 2 +- pkg/kubelet/remote/remote_runtime.go | 2 +- pkg/kubelet/rkt/rkt.go | 2 +- pkg/kubelet/rkt/rkt_test.go | 7 +- pkg/kubelet/server/remotecommand/exec.go | 2 +- pkg/kubemark/hollow_proxy.go | 2 +- pkg/probe/exec/exec.go | 2 +- pkg/proxy/iptables/proxier.go | 2 +- pkg/proxy/iptables/proxier_test.go | 17 +- pkg/proxy/userspace/proxier.go | 2 +- pkg/proxy/userspace/proxier_test.go | 15 +- pkg/proxy/util/conntrack.go | 2 +- pkg/proxy/util/conntrack_test.go | 31 +- pkg/proxy/winuserspace/proxysocket.go | 2 +- pkg/util/bandwidth/linux.go | 2 +- pkg/util/bandwidth/linux_test.go | 103 ++--- pkg/util/ebtables/ebtables.go | 2 +- pkg/util/ebtables/ebtables_test.go | 43 +- pkg/util/ipconfig/ipconfig.go | 2 +- pkg/util/ipconfig/ipconfig_test.go | 2 +- pkg/util/iptables/iptables.go | 2 +- pkg/util/iptables/iptables_test.go | 417 +++++++++--------- pkg/util/mount/mount.go | 2 +- pkg/util/mount/mount_linux.go | 2 +- pkg/util/mount/nsenter_mount.go | 2 +- pkg/util/mount/safe_format_and_mount_test.go | 19 +- pkg/util/netsh/netsh.go | 2 +- pkg/volume/aws_ebs/attacher.go | 2 +- pkg/volume/aws_ebs/aws_ebs.go | 2 +- pkg/volume/azure_dd/attacher.go | 2 +- pkg/volume/azure_dd/azure_common.go | 2 +- pkg/volume/azure_dd/azure_common_test.go | 17 +- pkg/volume/cinder/attacher.go | 2 +- pkg/volume/cinder/cinder.go | 2 +- pkg/volume/cinder/cinder_util.go | 2 +- pkg/volume/fc/attacher.go | 2 +- pkg/volume/fc/fc.go | 2 +- pkg/volume/flexvolume/attacher-defaults.go | 2 +- pkg/volume/flexvolume/common_test.go | 19 +- pkg/volume/flexvolume/mounter.go | 2 +- pkg/volume/flexvolume/plugin.go | 2 +- pkg/volume/flexvolume/plugin_test.go | 2 +- pkg/volume/flexvolume/unmounter.go | 2 +- pkg/volume/gce_pd/attacher.go | 2 +- pkg/volume/gce_pd/gce_util.go | 2 +- pkg/volume/git_repo/git_repo.go | 2 +- pkg/volume/git_repo/git_repo_test.go | 15 +- pkg/volume/glusterfs/glusterfs.go | 2 +- pkg/volume/glusterfs/glusterfs_test.go | 15 +- pkg/volume/iscsi/iscsi.go | 2 +- pkg/volume/nfs/nfs.go | 2 +- pkg/volume/photon_pd/attacher.go | 2 +- pkg/volume/photon_pd/photon_pd.go | 2 +- pkg/volume/portworx/portworx.go | 2 +- pkg/volume/quobyte/quobyte.go | 2 +- pkg/volume/rbd/rbd.go | 2 +- pkg/volume/rbd/rbd_util.go | 2 +- pkg/volume/scaleio/sio_volume.go | 2 +- pkg/volume/storageos/storageos.go | 2 +- pkg/volume/storageos/storageos_util.go | 2 +- pkg/volume/vsphere_volume/attacher.go | 2 +- pkg/volume/vsphere_volume/vsphere_volume.go | 2 +- test/e2e/framework/ingress_utils.go | 2 +- test/e2e/framework/util.go | 2 +- test/e2e/kubectl/kubectl.go | 2 +- 83 files changed, 464 insertions(+), 449 deletions(-) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index ec9065f2ef..da21b6a996 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -62,7 +62,6 @@ import ( "k8s.io/kubernetes/pkg/proxy/winuserspace" "k8s.io/kubernetes/pkg/util/configz" utildbus "k8s.io/kubernetes/pkg/util/dbus" - "k8s.io/kubernetes/pkg/util/exec" utiliptables "k8s.io/kubernetes/pkg/util/iptables" utilnetsh "k8s.io/kubernetes/pkg/util/netsh" utilnode "k8s.io/kubernetes/pkg/util/node" @@ -71,6 +70,7 @@ import ( "k8s.io/kubernetes/pkg/util/resourcecontainer" utilsysctl "k8s.io/kubernetes/pkg/util/sysctl" "k8s.io/kubernetes/pkg/version/verflag" + "k8s.io/utils/exec" "github.com/golang/glog" "github.com/prometheus/client_golang/prometheus" diff --git a/cmd/kubemark/hollow-node.go b/cmd/kubemark/hollow-node.go index 5b69f2bb54..593344c14b 100644 --- a/cmd/kubemark/hollow-node.go +++ b/cmd/kubemark/hollow-node.go @@ -34,10 +34,10 @@ import ( "k8s.io/kubernetes/pkg/kubelet/cm" "k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker" "k8s.io/kubernetes/pkg/kubemark" - fakeexec "k8s.io/kubernetes/pkg/util/exec" fakeiptables "k8s.io/kubernetes/pkg/util/iptables/testing" fakesysctl "k8s.io/kubernetes/pkg/util/sysctl/testing" _ "k8s.io/kubernetes/pkg/version/prometheus" // for version metric registration + fakeexec "k8s.io/utils/exec/testing" "github.com/golang/glog" "github.com/spf13/pflag" diff --git a/pkg/cloudprovider/providers/openstack/metadata.go b/pkg/cloudprovider/providers/openstack/metadata.go index 0ea608a81a..9ab0e09189 100644 --- a/pkg/cloudprovider/providers/openstack/metadata.go +++ b/pkg/cloudprovider/providers/openstack/metadata.go @@ -28,8 +28,8 @@ import ( "strings" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" + "k8s.io/utils/exec" ) // metadataUrl is URL to OpenStack metadata server. It's hardcoded IPv4 diff --git a/pkg/kubectl/cmd/run.go b/pkg/kubectl/cmd/run.go index f7b3cd56bc..b0ad01a2be 100644 --- a/pkg/kubectl/cmd/run.go +++ b/pkg/kubectl/cmd/run.go @@ -40,9 +40,9 @@ import ( "k8s.io/kubernetes/pkg/kubectl/cmd/templates" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" - uexec "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/i18n" "k8s.io/kubernetes/pkg/util/interrupt" + uexec "k8s.io/utils/exec" ) var ( diff --git a/pkg/kubectl/cmd/util/helpers.go b/pkg/kubectl/cmd/util/helpers.go index bf5f57ce5a..0cd966c632 100644 --- a/pkg/kubectl/cmd/util/helpers.go +++ b/pkg/kubectl/cmd/util/helpers.go @@ -48,7 +48,7 @@ import ( "k8s.io/kubernetes/pkg/kubectl" "k8s.io/kubernetes/pkg/kubectl/resource" "k8s.io/kubernetes/pkg/printers" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/kubectl/cmd/util/helpers_test.go b/pkg/kubectl/cmd/util/helpers_test.go index eb64a96021..9b5b86c441 100644 --- a/pkg/kubectl/cmd/util/helpers_test.go +++ b/pkg/kubectl/cmd/util/helpers_test.go @@ -35,7 +35,7 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api/testapi" apitesting "k8s.io/kubernetes/pkg/api/testing" - uexec "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" ) func TestMerge(t *testing.T) { @@ -266,7 +266,7 @@ func TestCheckNoResourceMatchError(t *testing.T) { func TestCheckExitError(t *testing.T) { testCheckError(t, []checkErrTestCase{ { - uexec.CodeExitError{Err: fmt.Errorf("pod foo/bar terminated"), Code: 42}, + exec.CodeExitError{Err: fmt.Errorf("pod foo/bar terminated"), Code: 42}, "pod foo/bar terminated", 42, }, diff --git a/pkg/kubelet/dockershim/exec.go b/pkg/kubelet/dockershim/exec.go index 881afea6c3..6d4b229cd8 100644 --- a/pkg/kubelet/dockershim/exec.go +++ b/pkg/kubelet/dockershim/exec.go @@ -28,8 +28,8 @@ import ( "k8s.io/client-go/tools/remotecommand" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" - utilexec "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/term" + utilexec "k8s.io/utils/exec" "k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker" ) diff --git a/pkg/kubelet/dockershim/remote/docker_service.go b/pkg/kubelet/dockershim/remote/docker_service.go index e224708eb4..13a5e8bfd2 100644 --- a/pkg/kubelet/dockershim/remote/docker_service.go +++ b/pkg/kubelet/dockershim/remote/docker_service.go @@ -25,7 +25,7 @@ import ( internalapi "k8s.io/kubernetes/pkg/kubelet/apis/cri" runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" "k8s.io/kubernetes/pkg/kubelet/dockershim" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) // DockerService is the interface implement CRI remote service server. diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 9759e3dc03..7949b6f9ec 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -99,7 +99,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/volumemanager" "k8s.io/kubernetes/pkg/security/apparmor" utildbus "k8s.io/kubernetes/pkg/util/dbus" - utilexec "k8s.io/kubernetes/pkg/util/exec" kubeio "k8s.io/kubernetes/pkg/util/io" utilipt "k8s.io/kubernetes/pkg/util/iptables" "k8s.io/kubernetes/pkg/util/mount" @@ -107,6 +106,7 @@ import ( "k8s.io/kubernetes/pkg/util/oom" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/kubelet/network/cni/cni.go b/pkg/kubelet/network/cni/cni.go index 1e9c91b818..02c3719c09 100644 --- a/pkg/kubelet/network/cni/cni.go +++ b/pkg/kubelet/network/cni/cni.go @@ -29,7 +29,7 @@ import ( "k8s.io/kubernetes/pkg/apis/componentconfig" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" "k8s.io/kubernetes/pkg/kubelet/network" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/kubelet/network/cni/cni_test.go b/pkg/kubelet/network/cni/cni_test.go index 8b3b078718..8e39009d73 100644 --- a/pkg/kubelet/network/cni/cni_test.go +++ b/pkg/kubelet/network/cni/cni_test.go @@ -43,7 +43,8 @@ import ( "k8s.io/kubernetes/pkg/kubelet/network/cni/testing" "k8s.io/kubernetes/pkg/kubelet/network/hostport" networktest "k8s.io/kubernetes/pkg/kubelet/network/testing" - utilexec "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func installPluginUnderTest(t *testing.T, testVendorCNIDirPrefix, testNetworkConfigPath, vendorName string, plugName string) { @@ -159,10 +160,10 @@ func TestCNIPlugin(t *testing.T) { podIP := "10.0.0.2" podIPOutput := fmt.Sprintf("4: eth0 inet %s/24 scope global dynamic eth0\\ valid_lft forever preferred_lft forever", podIP) - fakeCmds := []utilexec.FakeCommandAction{ - func(cmd string, args ...string) utilexec.Cmd { - return utilexec.InitFakeCmd(&utilexec.FakeCmd{ - CombinedOutputScript: []utilexec.FakeCombinedOutputAction{ + fakeCmds := []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { + return fakeexec.InitFakeCmd(&fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(podIPOutput), nil }, @@ -171,7 +172,7 @@ func TestCNIPlugin(t *testing.T) { }, } - fexec := &utilexec.FakeExec{ + fexec := &fakeexec.FakeExec{ CommandScript: fakeCmds, LookPathFunc: func(file string) (string, error) { return fmt.Sprintf("/fake-bin/%s", file), nil diff --git a/pkg/kubelet/network/hairpin/hairpin.go b/pkg/kubelet/network/hairpin/hairpin.go index 3bea370445..fd9cdf43e9 100644 --- a/pkg/kubelet/network/hairpin/hairpin.go +++ b/pkg/kubelet/network/hairpin/hairpin.go @@ -26,7 +26,7 @@ import ( "strconv" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" ) const ( diff --git a/pkg/kubelet/network/hairpin/hairpin_test.go b/pkg/kubelet/network/hairpin/hairpin_test.go index 8c667f0c69..c749183a26 100644 --- a/pkg/kubelet/network/hairpin/hairpin_test.go +++ b/pkg/kubelet/network/hairpin/hairpin_test.go @@ -24,7 +24,8 @@ import ( "strings" "testing" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func TestFindPairInterfaceOfContainerInterface(t *testing.T) { @@ -54,15 +55,15 @@ func TestFindPairInterfaceOfContainerInterface(t *testing.T) { }, } for _, test := range tests { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(test.output), test.err }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ func(cmd string, args ...string) exec.Cmd { - return exec.InitFakeCmd(&fcmd, cmd, args...) + return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, LookPathFunc: func(file string) (string, error) { diff --git a/pkg/kubelet/network/kubenet/kubenet_linux.go b/pkg/kubelet/network/kubenet/kubenet_linux.go index 81aa2373b8..30f652e73d 100644 --- a/pkg/kubelet/network/kubenet/kubenet_linux.go +++ b/pkg/kubelet/network/kubenet/kubenet_linux.go @@ -45,9 +45,9 @@ import ( "k8s.io/kubernetes/pkg/util/bandwidth" utildbus "k8s.io/kubernetes/pkg/util/dbus" utilebtables "k8s.io/kubernetes/pkg/util/ebtables" - utilexec "k8s.io/kubernetes/pkg/util/exec" utiliptables "k8s.io/kubernetes/pkg/util/iptables" utilsysctl "k8s.io/kubernetes/pkg/util/sysctl" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/kubelet/network/kubenet/kubenet_linux_test.go b/pkg/kubelet/network/kubenet/kubenet_linux_test.go index 4a1a255b6b..beff2e8138 100644 --- a/pkg/kubelet/network/kubenet/kubenet_linux_test.go +++ b/pkg/kubelet/network/kubenet/kubenet_linux_test.go @@ -32,9 +32,10 @@ import ( hostporttest "k8s.io/kubernetes/pkg/kubelet/network/hostport/testing" nettest "k8s.io/kubernetes/pkg/kubelet/network/testing" "k8s.io/kubernetes/pkg/util/bandwidth" - "k8s.io/kubernetes/pkg/util/exec" ipttest "k8s.io/kubernetes/pkg/util/iptables/testing" sysctltest "k8s.io/kubernetes/pkg/util/sysctl/testing" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) // test it fulfills the NetworkPlugin interface @@ -79,11 +80,11 @@ func TestGetPodNetworkStatus(t *testing.T) { //TODO: add test cases for retrieving ip inside container network namespace } - fakeCmds := make([]exec.FakeCommandAction, 0) + fakeCmds := make([]fakeexec.FakeCommandAction, 0) for _, t := range testCases { // the fake commands return the IP from the given index, or an error - fCmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fCmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { ip, ok := podIPMap[kubecontainer.ContainerID{ID: t.id}] if !ok { @@ -94,10 +95,10 @@ func TestGetPodNetworkStatus(t *testing.T) { }, } fakeCmds = append(fakeCmds, func(cmd string, args ...string) exec.Cmd { - return exec.InitFakeCmd(&fCmd, cmd, args...) + return fakeexec.InitFakeCmd(&fCmd, cmd, args...) }) } - fexec := exec.FakeExec{ + fexec := fakeexec.FakeExec{ CommandScript: fakeCmds, LookPathFunc: func(file string) (string, error) { return fmt.Sprintf("/fake-bin/%s", file), nil @@ -128,8 +129,8 @@ func TestGetPodNetworkStatus(t *testing.T) { // TestTeardownCallsShaper tests that a `TearDown` call does call // `shaper.Reset` func TestTeardownCallsShaper(t *testing.T) { - fexec := &exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{}, + fexec := &fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{}, LookPathFunc: func(file string) (string, error) { return fmt.Sprintf("/fake-bin/%s", file), nil }, @@ -162,22 +163,22 @@ func TestTeardownCallsShaper(t *testing.T) { // TestInit tests that a `Init` call with an MTU sets the MTU func TestInit_MTU(t *testing.T) { - var fakeCmds []exec.FakeCommandAction + var fakeCmds []fakeexec.FakeCommandAction { // modprobe br-netfilter - fCmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fCmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return make([]byte, 0), nil }, }, } fakeCmds = append(fakeCmds, func(cmd string, args ...string) exec.Cmd { - return exec.InitFakeCmd(&fCmd, cmd, args...) + return fakeexec.InitFakeCmd(&fCmd, cmd, args...) }) } - fexec := &exec.FakeExec{ + fexec := &fakeexec.FakeExec{ CommandScript: fakeCmds, LookPathFunc: func(file string) (string, error) { return fmt.Sprintf("/fake-bin/%s", file), nil @@ -254,8 +255,8 @@ func TestTearDownWithoutRuntime(t *testing.T) { fhost.Runtime = nil mockcni := &mock_cni.MockCNI{} - fexec := &exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{}, + fexec := &fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{}, LookPathFunc: func(file string) (string, error) { return fmt.Sprintf("/fake-bin/%s", file), nil }, diff --git a/pkg/kubelet/network/plugins.go b/pkg/kubelet/network/plugins.go index ca75c95a33..08c6ef2d49 100644 --- a/pkg/kubelet/network/plugins.go +++ b/pkg/kubelet/network/plugins.go @@ -32,8 +32,8 @@ import ( "k8s.io/kubernetes/pkg/apis/componentconfig" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" "k8s.io/kubernetes/pkg/kubelet/network/hostport" - utilexec "k8s.io/kubernetes/pkg/util/exec" utilsysctl "k8s.io/kubernetes/pkg/util/sysctl" + utilexec "k8s.io/utils/exec" ) const DefaultPluginName = "kubernetes.io/no-op" diff --git a/pkg/kubelet/prober/common_test.go b/pkg/kubelet/prober/common_test.go index 6c99ea19e3..f19ecd97b0 100644 --- a/pkg/kubelet/prober/common_test.go +++ b/pkg/kubelet/prober/common_test.go @@ -30,7 +30,7 @@ import ( "k8s.io/kubernetes/pkg/kubelet/status" statustest "k8s.io/kubernetes/pkg/kubelet/status/testing" "k8s.io/kubernetes/pkg/probe" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" ) const ( diff --git a/pkg/kubelet/prober/prober.go b/pkg/kubelet/prober/prober.go index 3da2dcbcae..076d5b676c 100644 --- a/pkg/kubelet/prober/prober.go +++ b/pkg/kubelet/prober/prober.go @@ -37,7 +37,7 @@ import ( execprobe "k8s.io/kubernetes/pkg/probe/exec" httprobe "k8s.io/kubernetes/pkg/probe/http" tcprobe "k8s.io/kubernetes/pkg/probe/tcp" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" "github.com/golang/glog" ) diff --git a/pkg/kubelet/prober/worker_test.go b/pkg/kubelet/prober/worker_test.go index e7bc904ba5..30f408fa55 100644 --- a/pkg/kubelet/prober/worker_test.go +++ b/pkg/kubelet/prober/worker_test.go @@ -33,7 +33,7 @@ import ( "k8s.io/kubernetes/pkg/kubelet/status" statustest "k8s.io/kubernetes/pkg/kubelet/status/testing" "k8s.io/kubernetes/pkg/probe" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" ) func init() { diff --git a/pkg/kubelet/remote/remote_runtime.go b/pkg/kubelet/remote/remote_runtime.go index 096ef32be5..647c564b7e 100644 --- a/pkg/kubelet/remote/remote_runtime.go +++ b/pkg/kubelet/remote/remote_runtime.go @@ -28,7 +28,7 @@ import ( internalapi "k8s.io/kubernetes/pkg/kubelet/apis/cri" runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" "k8s.io/kubernetes/pkg/kubelet/util" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) // RemoteRuntimeService is a gRPC implementation of internalapi.RuntimeService. diff --git a/pkg/kubelet/rkt/rkt.go b/pkg/kubelet/rkt/rkt.go index 6e6addfe03..359ad6d1de 100644 --- a/pkg/kubelet/rkt/rkt.go +++ b/pkg/kubelet/rkt/rkt.go @@ -62,10 +62,10 @@ import ( "k8s.io/kubernetes/pkg/kubelet/types" "k8s.io/kubernetes/pkg/kubelet/util/format" "k8s.io/kubernetes/pkg/securitycontext" - utilexec "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/selinux" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/util/term" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/kubelet/rkt/rkt_test.go b/pkg/kubelet/rkt/rkt_test.go index 18092169b6..6b51e5095d 100644 --- a/pkg/kubelet/rkt/rkt_test.go +++ b/pkg/kubelet/rkt/rkt_test.go @@ -46,7 +46,8 @@ import ( "k8s.io/kubernetes/pkg/kubelet/network/kubenet" nettest "k8s.io/kubernetes/pkg/kubelet/network/testing" "k8s.io/kubernetes/pkg/kubelet/types" - utilexec "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" "strings" ) @@ -1415,8 +1416,8 @@ func TestGenerateRunCommand(t *testing.T) { HostName: tt.hostName, Err: tt.err, } - rkt.execer = &utilexec.FakeExec{CommandScript: []utilexec.FakeCommandAction{func(cmd string, args ...string) utilexec.Cmd { - return utilexec.InitFakeCmd(&utilexec.FakeCmd{}, cmd, args...) + rkt.execer = &fakeexec.FakeExec{CommandScript: []fakeexec.FakeCommandAction{func(cmd string, args ...string) exec.Cmd { + return fakeexec.InitFakeCmd(&fakeexec.FakeCmd{}, cmd, args...) }}} // a command should be created of this form, but the returned command shouldn't be called (asserted by having no expectations on it) diff --git a/pkg/kubelet/server/remotecommand/exec.go b/pkg/kubelet/server/remotecommand/exec.go index 8d14a937a3..8eaf82a6fe 100644 --- a/pkg/kubelet/server/remotecommand/exec.go +++ b/pkg/kubelet/server/remotecommand/exec.go @@ -28,7 +28,7 @@ import ( remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/client-go/tools/remotecommand" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) // Executor knows how to execute a command in a container in a pod. diff --git a/pkg/kubemark/hollow_proxy.go b/pkg/kubemark/hollow_proxy.go index 11db20e7d0..1a9525ebb6 100644 --- a/pkg/kubemark/hollow_proxy.go +++ b/pkg/kubemark/hollow_proxy.go @@ -32,11 +32,11 @@ import ( "k8s.io/kubernetes/pkg/proxy" proxyconfig "k8s.io/kubernetes/pkg/proxy/config" "k8s.io/kubernetes/pkg/proxy/iptables" - utilexec "k8s.io/kubernetes/pkg/util/exec" utiliptables "k8s.io/kubernetes/pkg/util/iptables" utilnode "k8s.io/kubernetes/pkg/util/node" utilpointer "k8s.io/kubernetes/pkg/util/pointer" utilsysctl "k8s.io/kubernetes/pkg/util/sysctl" + utilexec "k8s.io/utils/exec" "github.com/golang/glog" ) diff --git a/pkg/probe/exec/exec.go b/pkg/probe/exec/exec.go index 2507ca4389..817492a609 100644 --- a/pkg/probe/exec/exec.go +++ b/pkg/probe/exec/exec.go @@ -18,7 +18,7 @@ package exec import ( "k8s.io/kubernetes/pkg/probe" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" "github.com/golang/glog" ) diff --git a/pkg/proxy/iptables/proxier.go b/pkg/proxy/iptables/proxier.go index 0a8123be09..3ca08763b8 100644 --- a/pkg/proxy/iptables/proxier.go +++ b/pkg/proxy/iptables/proxier.go @@ -49,10 +49,10 @@ import ( "k8s.io/kubernetes/pkg/proxy/healthcheck" utilproxy "k8s.io/kubernetes/pkg/proxy/util" "k8s.io/kubernetes/pkg/util/async" - utilexec "k8s.io/kubernetes/pkg/util/exec" utiliptables "k8s.io/kubernetes/pkg/util/iptables" utilsysctl "k8s.io/kubernetes/pkg/util/sysctl" utilversion "k8s.io/kubernetes/pkg/util/version" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/proxy/iptables/proxier_test.go b/pkg/proxy/iptables/proxier_test.go index 894a98ccc4..768f0db8ff 100644 --- a/pkg/proxy/iptables/proxier_test.go +++ b/pkg/proxy/iptables/proxier_test.go @@ -36,9 +36,10 @@ import ( "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/proxy" "k8s.io/kubernetes/pkg/util/async" - "k8s.io/kubernetes/pkg/util/exec" utiliptables "k8s.io/kubernetes/pkg/util/iptables" iptablestest "k8s.io/kubernetes/pkg/util/iptables/testing" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func checkAllLines(t *testing.T, table utiliptables.Table, save []byte, expectedLines map[utiliptables.Chain]string) { @@ -187,18 +188,18 @@ func newFakeServiceInfo(service proxy.ServicePortName, ip net.IP, port int, prot } func TestDeleteEndpointConnections(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte("1 flow entries have been deleted"), nil }, func() ([]byte, error) { return []byte(""), fmt.Errorf("conntrack v1.4.2 (conntrack-tools): 0 flow entries have been deleted.") }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, LookPathFunc: func(cmd string) (string, error) { return cmd, nil }, } @@ -386,7 +387,7 @@ func NewFakeProxier(ipt utiliptables.Interface) *Proxier { // TODO: Call NewProxier after refactoring out the goroutine // invocation into a Run() method. p := &Proxier{ - exec: &exec.FakeExec{}, + exec: &fakeexec.FakeExec{}, serviceMap: make(proxyServiceMap), serviceChanges: newServiceChangeMap(), endpointsMap: make(proxyEndpointsMap), diff --git a/pkg/proxy/userspace/proxier.go b/pkg/proxy/userspace/proxier.go index 5224d45d4b..86f9ff31af 100644 --- a/pkg/proxy/userspace/proxier.go +++ b/pkg/proxy/userspace/proxier.go @@ -36,8 +36,8 @@ import ( "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" utilproxy "k8s.io/kubernetes/pkg/proxy/util" - utilexec "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/iptables" + utilexec "k8s.io/utils/exec" ) type portal struct { diff --git a/pkg/proxy/userspace/proxier_test.go b/pkg/proxy/userspace/proxier_test.go index b497318a97..d3699a0a7e 100644 --- a/pkg/proxy/userspace/proxier_test.go +++ b/pkg/proxy/userspace/proxier_test.go @@ -34,8 +34,9 @@ import ( "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/proxy" - "k8s.io/kubernetes/pkg/util/exec" ipttest "k8s.io/kubernetes/pkg/util/iptables/testing" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) const ( @@ -905,15 +906,15 @@ func TestProxyUpdatePortal(t *testing.T) { waitForNumProxyLoops(t, p, 1) } -func makeFakeExec() *exec.FakeExec { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ +func makeFakeExec() *fakeexec.FakeExec { + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte("1 flow entries have been deleted"), nil }, }, } - return &exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + return &fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, LookPathFunc: func(cmd string) (string, error) { return cmd, nil }, } diff --git a/pkg/proxy/util/conntrack.go b/pkg/proxy/util/conntrack.go index 436045ecb3..389de1f555 100644 --- a/pkg/proxy/util/conntrack.go +++ b/pkg/proxy/util/conntrack.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" "github.com/golang/glog" ) diff --git a/pkg/proxy/util/conntrack_test.go b/pkg/proxy/util/conntrack_test.go index 05729f51e3..a788f1f67f 100644 --- a/pkg/proxy/util/conntrack_test.go +++ b/pkg/proxy/util/conntrack_test.go @@ -21,12 +21,13 @@ import ( "strings" "testing" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func TestExecConntrackTool(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte("1 flow entries have been deleted"), nil }, func() ([]byte, error) { return []byte("1 flow entries have been deleted"), nil }, func() ([]byte, error) { @@ -34,11 +35,11 @@ func TestExecConntrackTool(t *testing.T) { }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, LookPathFunc: func(cmd string) (string, error) { return cmd, nil }, } @@ -74,8 +75,8 @@ func TestExecConntrackTool(t *testing.T) { } func TestDeleteServiceConnections(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte("1 flow entries have been deleted"), nil }, func() ([]byte, error) { return []byte("1 flow entries have been deleted"), nil }, func() ([]byte, error) { @@ -83,11 +84,11 @@ func TestDeleteServiceConnections(t *testing.T) { }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, LookPathFunc: func(cmd string) (string, error) { return cmd, nil }, } diff --git a/pkg/proxy/winuserspace/proxysocket.go b/pkg/proxy/winuserspace/proxysocket.go index 08bc0c25a6..ced3a8b0cc 100644 --- a/pkg/proxy/winuserspace/proxysocket.go +++ b/pkg/proxy/winuserspace/proxysocket.go @@ -32,8 +32,8 @@ import ( "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/proxy" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/ipconfig" + "k8s.io/utils/exec" ) const ( diff --git a/pkg/util/bandwidth/linux.go b/pkg/util/bandwidth/linux.go index 9949aa3d17..539e0588f9 100644 --- a/pkg/util/bandwidth/linux.go +++ b/pkg/util/bandwidth/linux.go @@ -28,7 +28,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/util/sets" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" "github.com/golang/glog" ) diff --git a/pkg/util/bandwidth/linux_test.go b/pkg/util/bandwidth/linux_test.go index 980f8f845c..61bfc13de3 100644 --- a/pkg/util/bandwidth/linux_test.go +++ b/pkg/util/bandwidth/linux_test.go @@ -25,7 +25,8 @@ import ( "testing" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) var tcClassOutput = `class htb 1:1 root prio 0 rate 10000bit ceil 10000bit burst 1600b cburst 1600b @@ -63,15 +64,15 @@ func TestNextClassID(t *testing.T) { }, } for _, test := range tests { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(test.output), test.err }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ func(cmd string, args ...string) exec.Cmd { - return exec.InitFakeCmd(&fcmd, cmd, args...) + return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } @@ -245,15 +246,15 @@ func TestFindCIDRClass(t *testing.T) { }, } for _, test := range tests { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(test.output), test.err }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ func(cmd string, args ...string) exec.Cmd { - return exec.InitFakeCmd(&fcmd, cmd, args...) + return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } @@ -284,15 +285,15 @@ func TestFindCIDRClass(t *testing.T) { } func TestGetCIDRs(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(tcFilterOutput), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ func(cmd string, args ...string) exec.Cmd { - return exec.InitFakeCmd(&fcmd, cmd, args...) + return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } @@ -349,8 +350,8 @@ func TestLimit(t *testing.T) { } for _, test := range tests { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(tcClassOutput), test.err }, func() ([]byte, error) { return []byte{}, test.err }, func() ([]byte, error) { return []byte{}, test.err }, @@ -360,14 +361,14 @@ func TestLimit(t *testing.T) { }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } iface := "cbr0" @@ -465,19 +466,19 @@ func TestReset(t *testing.T) { }, } for _, test := range tests { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(tcFilterOutput), test.err }, func() ([]byte, error) { return []byte{}, test.err }, func() ([]byte, error) { return []byte{}, test.err }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } iface := "cbr0" @@ -524,15 +525,15 @@ func TestReset(t *testing.T) { var tcQdisc = "qdisc htb 1: root refcnt 2 r2q 10 default 30 direct_packets_stat 0\n" func TestReconcileInterfaceExists(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(tcQdisc), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } iface := "cbr0" @@ -562,17 +563,17 @@ func TestReconcileInterfaceExists(t *testing.T) { } func testReconcileInterfaceHasNoData(t *testing.T, output string) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(output), nil }, func() ([]byte, error) { return []byte(output), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } iface := "cbr0" @@ -635,19 +636,19 @@ var tcQdiscWrong = []string{ func TestReconcileInterfaceIsWrong(t *testing.T) { for _, test := range tcQdiscWrong { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(test), nil }, func() ([]byte, error) { return []byte("\n"), nil }, func() ([]byte, error) { return []byte("\n"), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } iface := "cbr0" diff --git a/pkg/util/ebtables/ebtables.go b/pkg/util/ebtables/ebtables.go index c90be4a8e0..4a52df0fc8 100644 --- a/pkg/util/ebtables/ebtables.go +++ b/pkg/util/ebtables/ebtables.go @@ -22,7 +22,7 @@ import ( "strings" "sync" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/util/ebtables/ebtables_test.go b/pkg/util/ebtables/ebtables_test.go index 91f6feeb65..68094135c2 100644 --- a/pkg/util/ebtables/ebtables_test.go +++ b/pkg/util/ebtables/ebtables_test.go @@ -20,31 +20,32 @@ import ( "strings" "testing" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func TestEnsureChain(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // Does not Exists - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, // Success func() ([]byte, error) { return []byte{}, nil }, // Exists func() ([]byte, error) { return nil, nil }, // Does not Exists - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, // Fail to create chain - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 2} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 2} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } @@ -76,8 +77,8 @@ func TestEnsureChain(t *testing.T) { } func TestEnsureRule(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // Exists func() ([]byte, error) { return []byte(`Bridge table: filter @@ -93,14 +94,14 @@ Bridge chain: OUTPUT, entries: 4, policy: ACCEPT Bridge chain: TEST, entries: 0, policy: ACCEPT`), nil }, // Fail to create - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 2} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 2} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } diff --git a/pkg/util/ipconfig/ipconfig.go b/pkg/util/ipconfig/ipconfig.go index ce1571719f..907c087f8e 100644 --- a/pkg/util/ipconfig/ipconfig.go +++ b/pkg/util/ipconfig/ipconfig.go @@ -23,7 +23,7 @@ import ( "github.com/golang/glog" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) // Interface is an injectable interface for running ipconfig commands. Implementations must be goroutine-safe. diff --git a/pkg/util/ipconfig/ipconfig_test.go b/pkg/util/ipconfig/ipconfig_test.go index e378cfba2f..d598d961d7 100644 --- a/pkg/util/ipconfig/ipconfig_test.go +++ b/pkg/util/ipconfig/ipconfig_test.go @@ -19,7 +19,7 @@ package ipconfig import ( "testing" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" ) func TestGetDnsSuffixSearchList(t *testing.T) { diff --git a/pkg/util/iptables/iptables.go b/pkg/util/iptables/iptables.go index ecd59a476f..84e0fe0301 100644 --- a/pkg/util/iptables/iptables.go +++ b/pkg/util/iptables/iptables.go @@ -27,8 +27,8 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/util/sets" utildbus "k8s.io/kubernetes/pkg/util/dbus" - utilexec "k8s.io/kubernetes/pkg/util/exec" utilversion "k8s.io/kubernetes/pkg/util/version" + utilexec "k8s.io/utils/exec" ) type RulePosition string diff --git a/pkg/util/iptables/iptables_test.go b/pkg/util/iptables/iptables_test.go index c7b3fbb598..92c3a94b5c 100644 --- a/pkg/util/iptables/iptables_test.go +++ b/pkg/util/iptables/iptables_test.go @@ -26,7 +26,8 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/kubernetes/pkg/util/dbus" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) const TestLockfilePath = "xtables.lock" @@ -42,8 +43,8 @@ func getIPTablesCommand(protocol Protocol) string { } func testEnsureChain(t *testing.T, protocol Protocol) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check @@ -51,18 +52,18 @@ func testEnsureChain(t *testing.T, protocol Protocol) { // Success. func() ([]byte, error) { return []byte{}, nil }, // Exists. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, // Failure. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 2} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 2} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), protocol) @@ -106,8 +107,8 @@ func TestEnsureChainIpv6(t *testing.T) { } func TestFlushChain(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check @@ -115,15 +116,15 @@ func TestFlushChain(t *testing.T) { // Success. func() ([]byte, error) { return []byte{}, nil }, // Failure. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -147,8 +148,8 @@ func TestFlushChain(t *testing.T) { } func TestDeleteChain(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check @@ -156,15 +157,15 @@ func TestDeleteChain(t *testing.T) { // Success. func() ([]byte, error) { return []byte{}, nil }, // Failure. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -188,8 +189,8 @@ func TestDeleteChain(t *testing.T) { } func TestEnsureRuleAlreadyExists(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check @@ -198,14 +199,14 @@ func TestEnsureRuleAlreadyExists(t *testing.T) { func() ([]byte, error) { return []byte{}, nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Success of that exec means "done". - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -226,27 +227,27 @@ func TestEnsureRuleAlreadyExists(t *testing.T) { } func TestEnsureRuleNew(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, // Status 1 on the first call. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, // Success on the second call. func() ([]byte, error) { return []byte{}, nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Failure of that means create it. - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -267,24 +268,24 @@ func TestEnsureRuleNew(t *testing.T) { } func TestEnsureRuleErrorChecking(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, // Status 2 on the first call. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 2} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 2} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Failure of that means create it. - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -299,27 +300,27 @@ func TestEnsureRuleErrorChecking(t *testing.T) { } func TestEnsureRuleErrorCreating(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, // Status 1 on the first call. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, // Status 1 on the second call. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Failure of that means create it. - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -334,24 +335,24 @@ func TestEnsureRuleErrorCreating(t *testing.T) { } func TestDeleteRuleDoesNotExist(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, // Status 1 on the first call. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Failure of that exec means "does not exist". - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -369,8 +370,8 @@ func TestDeleteRuleDoesNotExist(t *testing.T) { } func TestDeleteRuleExists(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check @@ -381,15 +382,15 @@ func TestDeleteRuleExists(t *testing.T) { func() ([]byte, error) { return []byte{}, nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Success of that means delete it. - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -407,24 +408,24 @@ func TestDeleteRuleExists(t *testing.T) { } func TestDeleteRuleErrorChecking(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, // Status 2 on the first call. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 2} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 2} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Failure of that means create it. - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -439,8 +440,8 @@ func TestDeleteRuleErrorChecking(t *testing.T) { } func TestDeleteRuleErrorDeleting(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check @@ -448,18 +449,18 @@ func TestDeleteRuleErrorDeleting(t *testing.T) { // Success on the first call. func() ([]byte, error) { return []byte{}, nil }, // Status 1 on the second call. - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // The second Command() call is checking the rule. Success of that means delete it. - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -487,14 +488,14 @@ func TestGetIPTablesHasCheckCommand(t *testing.T) { } for _, testCase := range testCases { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(testCase.Version), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } version, err := getIPTablesVersionString(&fexec) @@ -520,16 +521,16 @@ func TestCheckRuleWithoutCheckPresent(t *testing.T) { COMMIT # Completed on Wed Oct 29 14:56:01 2014` - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // Success. func() ([]byte, error) { return []byte(iptables_save_output), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // The first Command() call is checking the rule. Success of that exec means "done". - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := &runner{exec: &fexec} @@ -563,16 +564,16 @@ func TestCheckRuleWithoutCheckAbsent(t *testing.T) { COMMIT # Completed on Wed Oct 29 14:56:01 2014` - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // Success. func() ([]byte, error) { return []byte(iptables_save_output), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // The first Command() call is checking the rule. Success of that exec means "done". - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := &runner{exec: &fexec} @@ -615,8 +616,8 @@ func TestIPTablesWaitFlag(t *testing.T) { } func TestWaitFlagUnavailable(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.4.19"), nil }, // iptables-restore version check @@ -625,13 +626,13 @@ func TestWaitFlagUnavailable(t *testing.T) { func() ([]byte, error) { return []byte{}, nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ // iptables version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, // iptables-restore version check - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -649,8 +650,8 @@ func TestWaitFlagUnavailable(t *testing.T) { } func TestWaitFlagOld(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.4.20"), nil }, // iptables-restore version check @@ -659,11 +660,11 @@ func TestWaitFlagOld(t *testing.T) { func() ([]byte, error) { return []byte{}, nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -684,8 +685,8 @@ func TestWaitFlagOld(t *testing.T) { } func TestWaitFlagNew(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.4.22"), nil }, // iptables-restore version check @@ -694,11 +695,11 @@ func TestWaitFlagNew(t *testing.T) { func() ([]byte, error) { return []byte{}, nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -726,8 +727,8 @@ func TestReload(t *testing.T) { reloaded := make(chan bool, 2) - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.4.22"), nil }, // iptables-restore version check @@ -737,7 +738,7 @@ func TestReload(t *testing.T) { // EnsureChain func() ([]byte, error) { return []byte{}, nil }, // EnsureRule abc check - func() ([]byte, error) { return []byte{}, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return []byte{}, &fakeexec.FakeExitError{Status: 1} }, // EnsureRule abc func() ([]byte, error) { return []byte{}, nil }, @@ -745,21 +746,21 @@ func TestReload(t *testing.T) { // EnsureChain func() ([]byte, error) { return []byte{}, nil }, // EnsureRule abc check - func() ([]byte, error) { return []byte{}, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return []byte{}, &fakeexec.FakeExitError{Status: 1} }, // EnsureRule abc func() ([]byte, error) { return []byte{}, nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } @@ -841,24 +842,24 @@ func TestSaveInto(t *testing.T) { COMMIT # Completed on Thu Jan 19 11:38:09 2017` - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, }, - RunScript: []exec.FakeRunAction{ + RunScript: []fakeexec.FakeRunAction{ func() ([]byte, []byte, error) { return []byte(output), nil, nil }, - func() ([]byte, []byte, error) { return nil, nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, []byte, error) { return nil, nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -894,8 +895,8 @@ COMMIT } func TestRestore(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check @@ -904,18 +905,18 @@ func TestRestore(t *testing.T) { func() ([]byte, error) { return []byte{}, nil }, func() ([]byte, error) { return []byte{}, nil }, func() ([]byte, error) { return []byte{}, nil }, - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := New(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4) @@ -978,22 +979,22 @@ func TestRestore(t *testing.T) { // TestRestoreAll tests only the simplest use case, as flag handling code is already tested in TestRestore func TestRestoreAll(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, func() ([]byte, error) { return []byte{}, nil }, - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) @@ -1023,22 +1024,22 @@ func TestRestoreAll(t *testing.T) { // TestRestoreAllWait tests that the "wait" flag is passed to a compatible iptables-restore func TestRestoreAllWait(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("iptables-restore v1.9.22"), nil }, func() ([]byte, error) { return []byte{}, nil }, - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) @@ -1069,22 +1070,22 @@ func TestRestoreAllWait(t *testing.T) { // TestRestoreAllWaitOldIptablesRestore tests that the "wait" flag is not passed // to a in-compatible iptables-restore func TestRestoreAllWaitOldIptablesRestore(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("unrecognized option: --version"), nil }, func() ([]byte, error) { return []byte{}, nil }, - func() ([]byte, error) { return nil, &exec.FakeExitError{Status: 1} }, + func() ([]byte, error) { return nil, &fakeexec.FakeExitError{Status: 1} }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } runner := newInternal(&fexec, dbus.NewFake(nil, nil), ProtocolIpv4, TestLockfilePath) @@ -1119,18 +1120,18 @@ func TestRestoreAllWaitOldIptablesRestore(t *testing.T) { // iptables /run lock when using an iptables-restore version that does not // support the --wait argument func TestRestoreAllGrabNewLock(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("unrecognized option: --version"), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } @@ -1162,18 +1163,18 @@ func TestRestoreAllGrabNewLock(t *testing.T) { // iptables @xtables abstract unix socket lock when using an iptables-restore // version that does not support the --wait argument func TestRestoreAllGrabOldLock(t *testing.T) { - fcmd := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fcmd := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // iptables version check func() ([]byte, error) { return []byte("iptables v1.9.22"), nil }, // iptables-restore version check func() ([]byte, error) { return []byte("unrecognized option: --version"), nil }, }, } - fexec := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fexec := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } diff --git a/pkg/util/mount/mount.go b/pkg/util/mount/mount.go index 0c458d64b4..00813a19a7 100644 --- a/pkg/util/mount/mount.go +++ b/pkg/util/mount/mount.go @@ -25,7 +25,7 @@ import ( "strings" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" ) const ( diff --git a/pkg/util/mount/mount_linux.go b/pkg/util/mount/mount_linux.go index 4c141ad5b0..237348034c 100644 --- a/pkg/util/mount/mount_linux.go +++ b/pkg/util/mount/mount_linux.go @@ -31,7 +31,7 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/util/sets" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) const ( diff --git a/pkg/util/mount/nsenter_mount.go b/pkg/util/mount/nsenter_mount.go index 4af8ef0d82..b9e9e09cca 100644 --- a/pkg/util/mount/nsenter_mount.go +++ b/pkg/util/mount/nsenter_mount.go @@ -25,7 +25,7 @@ import ( "strings" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" ) // NsenterMounter is part of experimental support for running the kubelet diff --git a/pkg/util/mount/safe_format_and_mount_test.go b/pkg/util/mount/safe_format_and_mount_test.go index 15f46f3e38..3ea9d575b1 100644 --- a/pkg/util/mount/safe_format_and_mount_test.go +++ b/pkg/util/mount/safe_format_and_mount_test.go @@ -21,7 +21,8 @@ import ( "runtime" "testing" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) type ErrorMounter struct { @@ -74,7 +75,7 @@ func TestSafeFormatAndMount(t *testing.T) { description: "Test 'fsck' fails with exit status 4", fstype: "ext4", execScripts: []ExecArgs{ - {"fsck", []string{"-a", "/dev/foo"}, "", &exec.FakeExitError{Status: 4}}, + {"fsck", []string{"-a", "/dev/foo"}, "", &fakeexec.FakeExitError{Status: 4}}, }, expectedError: fmt.Errorf("'fsck' found errors on device /dev/foo but could not correct them: ."), }, @@ -82,14 +83,14 @@ func TestSafeFormatAndMount(t *testing.T) { description: "Test 'fsck' fails with exit status 1 (errors found and corrected)", fstype: "ext4", execScripts: []ExecArgs{ - {"fsck", []string{"-a", "/dev/foo"}, "", &exec.FakeExitError{Status: 1}}, + {"fsck", []string{"-a", "/dev/foo"}, "", &fakeexec.FakeExitError{Status: 1}}, }, }, { description: "Test 'fsck' fails with exit status other than 1 and 4 (likely unformatted device)", fstype: "ext4", execScripts: []ExecArgs{ - {"fsck", []string{"-a", "/dev/foo"}, "", &exec.FakeExitError{Status: 8}}, + {"fsck", []string{"-a", "/dev/foo"}, "", &fakeexec.FakeExitError{Status: 8}}, }, }, { @@ -180,7 +181,7 @@ func TestSafeFormatAndMount(t *testing.T) { } for _, test := range tests { - commandScripts := []exec.FakeCommandAction{} + commandScripts := []fakeexec.FakeCommandAction{} for _, expected := range test.execScripts { ecmd := expected.command eargs := expected.args @@ -196,17 +197,17 @@ func TestSafeFormatAndMount(t *testing.T) { t.Errorf("Unexpected args %v. Expecting %v", args, eargs) } } - fake := exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + fake := fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ func() ([]byte, error) { return []byte(output), err }, }, } - return exec.InitFakeCmd(&fake, cmd, args...) + return fakeexec.InitFakeCmd(&fake, cmd, args...) } commandScripts = append(commandScripts, commandScript) } - fake := exec.FakeExec{ + fake := fakeexec.FakeExec{ CommandScript: commandScripts, } diff --git a/pkg/util/netsh/netsh.go b/pkg/util/netsh/netsh.go index 59d1a18b61..c3b963c411 100644 --- a/pkg/util/netsh/netsh.go +++ b/pkg/util/netsh/netsh.go @@ -25,7 +25,7 @@ import ( "time" "github.com/golang/glog" - utilexec "k8s.io/kubernetes/pkg/util/exec" + utilexec "k8s.io/utils/exec" ) // Interface is an injectable interface for running netsh commands. Implementations must be goroutine-safe. diff --git a/pkg/volume/aws_ebs/attacher.go b/pkg/volume/aws_ebs/attacher.go index 735f57ed97..2ccf0aa885 100644 --- a/pkg/volume/aws_ebs/attacher.go +++ b/pkg/volume/aws_ebs/attacher.go @@ -26,10 +26,10 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) type awsElasticBlockStoreAttacher struct { diff --git a/pkg/volume/aws_ebs/aws_ebs.go b/pkg/volume/aws_ebs/aws_ebs.go index 712d7ac2af..480ecd234b 100644 --- a/pkg/volume/aws_ebs/aws_ebs.go +++ b/pkg/volume/aws_ebs/aws_ebs.go @@ -30,12 +30,12 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/cloudprovider/providers/aws" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/azure_dd/attacher.go b/pkg/volume/azure_dd/attacher.go index 40c2a1bac8..cf71f65b1a 100644 --- a/pkg/volume/azure_dd/attacher.go +++ b/pkg/volume/azure_dd/attacher.go @@ -31,11 +31,11 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) type azureDiskDetacher struct { diff --git a/pkg/volume/azure_dd/azure_common.go b/pkg/volume/azure_dd/azure_common.go index 637b75a795..7c36b3984a 100644 --- a/pkg/volume/azure_dd/azure_common.go +++ b/pkg/volume/azure_dd/azure_common.go @@ -32,10 +32,10 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/cloudprovider/providers/azure" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/exec" ) const ( diff --git a/pkg/volume/azure_dd/azure_common_test.go b/pkg/volume/azure_dd/azure_common_test.go index b0f4988a9e..d026e2b92e 100644 --- a/pkg/volume/azure_dd/azure_common_test.go +++ b/pkg/volume/azure_dd/azure_common_test.go @@ -22,7 +22,8 @@ import ( "testing" "time" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) type fakeFileInfo struct { @@ -107,9 +108,9 @@ func (handler *fakeIOHandler) Readlink(name string) (string, error) { } func TestIoHandler(t *testing.T) { - var fcmd exec.FakeCmd - fcmd = exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + var fcmd fakeexec.FakeCmd + fcmd = fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // cat func() ([]byte, error) { return []byte("Msft \nVirtual Disk \n"), nil @@ -120,10 +121,10 @@ func TestIoHandler(t *testing.T) { }, }, } - fake := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fake := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } disk, err := findDiskByLun(lun, &fakeIOHandler{}, &fake) diff --git a/pkg/volume/cinder/attacher.go b/pkg/volume/cinder/attacher.go index 7c6cf470bc..901876d16b 100644 --- a/pkg/volume/cinder/attacher.go +++ b/pkg/volume/cinder/attacher.go @@ -26,10 +26,10 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/wait" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) type cinderDiskAttacher struct { diff --git a/pkg/volume/cinder/cinder.go b/pkg/volume/cinder/cinder.go index a88e378561..6e0e25e87d 100644 --- a/pkg/volume/cinder/cinder.go +++ b/pkg/volume/cinder/cinder.go @@ -30,13 +30,13 @@ import ( "k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider/providers/openstack" "k8s.io/kubernetes/pkg/cloudprovider/providers/rackspace" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/cinder/cinder_util.go b/pkg/volume/cinder/cinder_util.go index d33bac3136..53fb5904cb 100644 --- a/pkg/volume/cinder/cinder_util.go +++ b/pkg/volume/cinder/cinder_util.go @@ -31,8 +31,8 @@ import ( "k8s.io/apimachinery/pkg/util/sets" clientset "k8s.io/client-go/kubernetes" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/exec" ) type CinderDiskUtil struct{} diff --git a/pkg/volume/fc/attacher.go b/pkg/volume/fc/attacher.go index f3a506b01f..f92fd1b328 100644 --- a/pkg/volume/fc/attacher.go +++ b/pkg/volume/fc/attacher.go @@ -24,10 +24,10 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) type fcAttacher struct { diff --git a/pkg/volume/fc/fc.go b/pkg/volume/fc/fc.go index d5c4708e76..634cdb4ca6 100644 --- a/pkg/volume/fc/fc.go +++ b/pkg/volume/fc/fc.go @@ -23,11 +23,11 @@ import ( "github.com/golang/glog" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/flexvolume/attacher-defaults.go b/pkg/volume/flexvolume/attacher-defaults.go index 8cfb3f00ed..3073f4def0 100644 --- a/pkg/volume/flexvolume/attacher-defaults.go +++ b/pkg/volume/flexvolume/attacher-defaults.go @@ -22,9 +22,9 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/exec" ) type attacherDefaults flexVolumeAttacher diff --git a/pkg/volume/flexvolume/common_test.go b/pkg/volume/flexvolume/common_test.go index 514595ea64..079b32adac 100644 --- a/pkg/volume/flexvolume/common_test.go +++ b/pkg/volume/flexvolume/common_test.go @@ -23,9 +23,10 @@ import ( "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utiltesting "k8s.io/client-go/util/testing" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/volume" volumetesting "k8s.io/kubernetes/pkg/volume/testing" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func testPlugin() (*flexVolumeAttachablePlugin, string) { @@ -43,7 +44,7 @@ func testPlugin() (*flexVolumeAttachablePlugin, string) { }, rootDir } -func assertDriverCall(t *testing.T, output exec.FakeCombinedOutputAction, expectedCommand string, expectedArgs ...string) exec.FakeCommandAction { +func assertDriverCall(t *testing.T, output fakeexec.FakeCombinedOutputAction, expectedCommand string, expectedArgs ...string) fakeexec.FakeCommandAction { return func(cmd string, args ...string) exec.Cmd { if cmd != "/plugin/test" { t.Errorf("Wrong executable called: got %v, expected %v", cmd, "/plugin/test") @@ -55,20 +56,20 @@ func assertDriverCall(t *testing.T, output exec.FakeCombinedOutputAction, expect if !sameArgs(cmdArgs, expectedArgs) { t.Errorf("Wrong args for %s: got %v, expected %v", args[0], cmdArgs, expectedArgs) } - return &exec.FakeCmd{ + return &fakeexec.FakeCmd{ Argv: args, - CombinedOutputScript: []exec.FakeCombinedOutputAction{output}, + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{output}, } } } -func fakeRunner(fakeCommands ...exec.FakeCommandAction) exec.Interface { - return &exec.FakeExec{ +func fakeRunner(fakeCommands ...fakeexec.FakeCommandAction) exec.Interface { + return &fakeexec.FakeExec{ CommandScript: fakeCommands, } } -func fakeResultOutput(result interface{}) exec.FakeCombinedOutputAction { +func fakeResultOutput(result interface{}) fakeexec.FakeCombinedOutputAction { return func() ([]byte, error) { bytes, err := json.Marshal(result) if err != nil { @@ -78,11 +79,11 @@ func fakeResultOutput(result interface{}) exec.FakeCombinedOutputAction { } } -func successOutput() exec.FakeCombinedOutputAction { +func successOutput() fakeexec.FakeCombinedOutputAction { return fakeResultOutput(&DriverStatus{StatusSuccess, "", "", "", true, nil}) } -func notSupportedOutput() exec.FakeCombinedOutputAction { +func notSupportedOutput() fakeexec.FakeCombinedOutputAction { return fakeResultOutput(&DriverStatus{StatusNotSupported, "", "", "", false, nil}) } diff --git a/pkg/volume/flexvolume/mounter.go b/pkg/volume/flexvolume/mounter.go index 0fc791e678..316928c429 100644 --- a/pkg/volume/flexvolume/mounter.go +++ b/pkg/volume/flexvolume/mounter.go @@ -19,9 +19,9 @@ package flexvolume import ( "strconv" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/exec" ) // FlexVolumeMounter is the disk that will be exposed by this plugin. diff --git a/pkg/volume/flexvolume/plugin.go b/pkg/volume/flexvolume/plugin.go index 36c5e6e9d6..7b37514009 100644 --- a/pkg/volume/flexvolume/plugin.go +++ b/pkg/volume/flexvolume/plugin.go @@ -26,10 +26,10 @@ import ( api "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/exec" ) const flexVolumePluginName = "kubernetes.io/flexvolume" diff --git a/pkg/volume/flexvolume/plugin_test.go b/pkg/volume/flexvolume/plugin_test.go index c45ebb0f3d..17c540a874 100644 --- a/pkg/volume/flexvolume/plugin_test.go +++ b/pkg/volume/flexvolume/plugin_test.go @@ -19,7 +19,7 @@ package flexvolume import ( "testing" - "k8s.io/kubernetes/pkg/util/exec" + exec "k8s.io/utils/exec/testing" ) func TestInit(t *testing.T) { diff --git a/pkg/volume/flexvolume/unmounter.go b/pkg/volume/flexvolume/unmounter.go index 2959b53f94..ecb7d89230 100644 --- a/pkg/volume/flexvolume/unmounter.go +++ b/pkg/volume/flexvolume/unmounter.go @@ -21,9 +21,9 @@ import ( "os" "github.com/golang/glog" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) // FlexVolumeUnmounter is the disk that will be cleaned by this plugin. diff --git a/pkg/volume/gce_pd/attacher.go b/pkg/volume/gce_pd/attacher.go index c5cba531a4..0cf8b3d672 100644 --- a/pkg/volume/gce_pd/attacher.go +++ b/pkg/volume/gce_pd/attacher.go @@ -28,10 +28,10 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/kubernetes/pkg/cloudprovider/providers/gce" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) type gcePersistentDiskAttacher struct { diff --git a/pkg/volume/gce_pd/gce_util.go b/pkg/volume/gce_pd/gce_util.go index e8d63257e2..03efa75b31 100644 --- a/pkg/volume/gce_pd/gce_util.go +++ b/pkg/volume/gce_pd/gce_util.go @@ -28,9 +28,9 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/kubernetes/pkg/cloudprovider" gcecloud "k8s.io/kubernetes/pkg/cloudprovider/providers/gce" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) const ( diff --git a/pkg/volume/git_repo/git_repo.go b/pkg/volume/git_repo/git_repo.go index c89093d0d1..1948971e94 100644 --- a/pkg/volume/git_repo/git_repo.go +++ b/pkg/volume/git_repo/git_repo.go @@ -24,10 +24,10 @@ import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/git_repo/git_repo_test.go b/pkg/volume/git_repo/git_repo_test.go index 1fe36211ac..e851e43c47 100644 --- a/pkg/volume/git_repo/git_repo_test.go +++ b/pkg/volume/git_repo/git_repo_test.go @@ -28,10 +28,11 @@ import ( "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/empty_dir" volumetest "k8s.io/kubernetes/pkg/volume/testing" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func newTestHost(t *testing.T) (string, volume.VolumeHost) { @@ -320,8 +321,8 @@ func doTestSetUp(scenario struct { allErrs := []error{} // Construct combined outputs from expected commands - var fakeOutputs []exec.FakeCombinedOutputAction - var fcmd exec.FakeCmd + var fakeOutputs []fakeexec.FakeCombinedOutputAction + var fcmd fakeexec.FakeCmd for _, expected := range expecteds { if expected.cmd[1] == "clone" { fakeOutputs = append(fakeOutputs, func() ([]byte, error) { @@ -336,19 +337,19 @@ func doTestSetUp(scenario struct { }) } } - fcmd = exec.FakeCmd{ + fcmd = fakeexec.FakeCmd{ CombinedOutputScript: fakeOutputs, } // Construct fake exec outputs from fcmd - var fakeAction []exec.FakeCommandAction + var fakeAction []fakeexec.FakeCommandAction for i := 0; i < len(expecteds); i++ { fakeAction = append(fakeAction, func(cmd string, args ...string) exec.Cmd { - return exec.InitFakeCmd(&fcmd, cmd, args...) + return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }) } - fake := exec.FakeExec{ + fake := fakeexec.FakeExec{ CommandScript: fakeAction, } diff --git a/pkg/volume/glusterfs/glusterfs.go b/pkg/volume/glusterfs/glusterfs.go index d3b248f15d..4e3ec59353 100644 --- a/pkg/volume/glusterfs/glusterfs.go +++ b/pkg/volume/glusterfs/glusterfs.go @@ -37,12 +37,12 @@ import ( "k8s.io/apimachinery/pkg/types" clientset "k8s.io/client-go/kubernetes" v1helper "k8s.io/kubernetes/pkg/api/v1/helper" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. diff --git a/pkg/volume/glusterfs/glusterfs_test.go b/pkg/volume/glusterfs/glusterfs_test.go index 1a252074b1..687259ec17 100644 --- a/pkg/volume/glusterfs/glusterfs_test.go +++ b/pkg/volume/glusterfs/glusterfs_test.go @@ -30,10 +30,11 @@ import ( "k8s.io/client-go/kubernetes/fake" core "k8s.io/client-go/testing" utiltesting "k8s.io/client-go/util/testing" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumetest "k8s.io/kubernetes/pkg/volume/testing" + "k8s.io/utils/exec" + fakeexec "k8s.io/utils/exec/testing" ) func TestCanSupport(t *testing.T) { @@ -103,18 +104,18 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) { } ep := &v1.Endpoints{ObjectMeta: metav1.ObjectMeta{Name: "foo"}, Subsets: []v1.EndpointSubset{{ Addresses: []v1.EndpointAddress{{IP: "127.0.0.1"}}}}} - var fcmd exec.FakeCmd - fcmd = exec.FakeCmd{ - CombinedOutputScript: []exec.FakeCombinedOutputAction{ + var fcmd fakeexec.FakeCmd + fcmd = fakeexec.FakeCmd{ + CombinedOutputScript: []fakeexec.FakeCombinedOutputAction{ // mount func() ([]byte, error) { return []byte{}, nil }, }, } - fake := exec.FakeExec{ - CommandScript: []exec.FakeCommandAction{ - func(cmd string, args ...string) exec.Cmd { return exec.InitFakeCmd(&fcmd, cmd, args...) }, + fake := fakeexec.FakeExec{ + CommandScript: []fakeexec.FakeCommandAction{ + func(cmd string, args ...string) exec.Cmd { return fakeexec.InitFakeCmd(&fcmd, cmd, args...) }, }, } pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}} diff --git a/pkg/volume/iscsi/iscsi.go b/pkg/volume/iscsi/iscsi.go index 97de4128f6..3e47cc02a9 100644 --- a/pkg/volume/iscsi/iscsi.go +++ b/pkg/volume/iscsi/iscsi.go @@ -24,11 +24,11 @@ import ( "github.com/golang/glog" "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" ioutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/nfs/nfs.go b/pkg/volume/nfs/nfs.go index cf2eaf8b99..52169caf34 100644 --- a/pkg/volume/nfs/nfs.go +++ b/pkg/volume/nfs/nfs.go @@ -25,11 +25,11 @@ import ( "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/photon_pd/attacher.go b/pkg/volume/photon_pd/attacher.go index 2faf1d6e4d..9dd7e3f767 100644 --- a/pkg/volume/photon_pd/attacher.go +++ b/pkg/volume/photon_pd/attacher.go @@ -27,10 +27,10 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/cloudprovider/providers/photon" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) type photonPersistentDiskAttacher struct { diff --git a/pkg/volume/photon_pd/photon_pd.go b/pkg/volume/photon_pd/photon_pd.go index dffa347c48..446cd9aa06 100644 --- a/pkg/volume/photon_pd/photon_pd.go +++ b/pkg/volume/photon_pd/photon_pd.go @@ -26,12 +26,12 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/portworx/portworx.go b/pkg/volume/portworx/portworx.go index ec971a7e37..e65d4687f4 100644 --- a/pkg/volume/portworx/portworx.go +++ b/pkg/volume/portworx/portworx.go @@ -25,11 +25,11 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/pkg/volume/quobyte/quobyte.go b/pkg/volume/quobyte/quobyte.go index 5fae74de72..a63d952aa2 100644 --- a/pkg/volume/quobyte/quobyte.go +++ b/pkg/volume/quobyte/quobyte.go @@ -28,12 +28,12 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. diff --git a/pkg/volume/rbd/rbd.go b/pkg/volume/rbd/rbd.go index 6acfa671f0..6590f659da 100644 --- a/pkg/volume/rbd/rbd.go +++ b/pkg/volume/rbd/rbd.go @@ -28,12 +28,12 @@ import ( "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/uuid" clientset "k8s.io/client-go/kubernetes" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" volutil "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) var ( diff --git a/pkg/volume/rbd/rbd_util.go b/pkg/volume/rbd/rbd_util.go index 1b88cb642a..001054e903 100644 --- a/pkg/volume/rbd/rbd_util.go +++ b/pkg/volume/rbd/rbd_util.go @@ -35,10 +35,10 @@ import ( "github.com/golang/glog" "k8s.io/api/core/v1" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/util/node" "k8s.io/kubernetes/pkg/volume" + "k8s.io/utils/exec" ) const ( diff --git a/pkg/volume/scaleio/sio_volume.go b/pkg/volume/scaleio/sio_volume.go index 01cd7ceb32..8a051748e8 100644 --- a/pkg/volume/scaleio/sio_volume.go +++ b/pkg/volume/scaleio/sio_volume.go @@ -29,12 +29,12 @@ import ( meta "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/uuid" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) type sioVolume struct { diff --git a/pkg/volume/storageos/storageos.go b/pkg/volume/storageos/storageos.go index 5a416c348d..6541f2eeb3 100644 --- a/pkg/volume/storageos/storageos.go +++ b/pkg/volume/storageos/storageos.go @@ -31,12 +31,12 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" clientset "k8s.io/client-go/kubernetes" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" kstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // ProbeVolumePlugins is the primary entrypoint for volume plugins. diff --git a/pkg/volume/storageos/storageos_util.go b/pkg/volume/storageos/storageos_util.go index d4cadd873f..b2d1767abf 100644 --- a/pkg/volume/storageos/storageos_util.go +++ b/pkg/volume/storageos/storageos_util.go @@ -23,7 +23,7 @@ import ( "path" "strings" - "k8s.io/kubernetes/pkg/util/exec" + "k8s.io/utils/exec" "github.com/golang/glog" storageosapi "github.com/storageos/go-api" diff --git a/pkg/volume/vsphere_volume/attacher.go b/pkg/volume/vsphere_volume/attacher.go index 747d9d8d69..9155d84ada 100644 --- a/pkg/volume/vsphere_volume/attacher.go +++ b/pkg/volume/vsphere_volume/attacher.go @@ -25,11 +25,11 @@ import ( "github.com/golang/glog" "k8s.io/apimachinery/pkg/types" "k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/keymutex" "k8s.io/kubernetes/pkg/util/mount" "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util" + "k8s.io/utils/exec" ) type vsphereVMDKAttacher struct { diff --git a/pkg/volume/vsphere_volume/vsphere_volume.go b/pkg/volume/vsphere_volume/vsphere_volume.go index e4687a8286..0871055d33 100644 --- a/pkg/volume/vsphere_volume/vsphere_volume.go +++ b/pkg/volume/vsphere_volume/vsphere_volume.go @@ -27,12 +27,12 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" - "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/mount" utilstrings "k8s.io/kubernetes/pkg/util/strings" "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/pkg/volume/util/volumehelper" + "k8s.io/utils/exec" ) // This is the primary entrypoint for volume plugins. diff --git a/test/e2e/framework/ingress_utils.go b/test/e2e/framework/ingress_utils.go index bf289b8cb4..5aa5cbc116 100644 --- a/test/e2e/framework/ingress_utils.go +++ b/test/e2e/framework/ingress_utils.go @@ -48,10 +48,10 @@ import ( "k8s.io/apimachinery/pkg/util/wait" clientset "k8s.io/client-go/kubernetes" gcecloud "k8s.io/kubernetes/pkg/cloudprovider/providers/gce" - utilexec "k8s.io/kubernetes/pkg/util/exec" utilfile "k8s.io/kubernetes/pkg/util/file" "k8s.io/kubernetes/test/e2e/manifest" testutils "k8s.io/kubernetes/test/utils" + utilexec "k8s.io/utils/exec" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 18dae6704c..112272037f 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -90,13 +90,13 @@ import ( "k8s.io/kubernetes/pkg/kubelet/util/format" "k8s.io/kubernetes/pkg/master/ports" sshutil "k8s.io/kubernetes/pkg/ssh" - uexec "k8s.io/kubernetes/pkg/util/exec" "k8s.io/kubernetes/pkg/util/system" utilversion "k8s.io/kubernetes/pkg/util/version" "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/predicates" "k8s.io/kubernetes/plugin/pkg/scheduler/schedulercache" "k8s.io/kubernetes/test/e2e/framework/ginkgowrapper" testutil "k8s.io/kubernetes/test/utils" + uexec "k8s.io/utils/exec" ) const ( diff --git a/test/e2e/kubectl/kubectl.go b/test/e2e/kubectl/kubectl.go index 516dd8b4bd..326c015dd0 100644 --- a/test/e2e/kubectl/kubectl.go +++ b/test/e2e/kubectl/kubectl.go @@ -59,12 +59,12 @@ import ( batchv2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1" "k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/kubectl/cmd/util" - uexec "k8s.io/kubernetes/pkg/util/exec" utilversion "k8s.io/kubernetes/pkg/util/version" "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/generated" "k8s.io/kubernetes/test/e2e/scheduling" testutils "k8s.io/kubernetes/test/utils" + uexec "k8s.io/utils/exec" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" From 9b393a83d4181e629e9eb139cd42d7b8ebf6fdad Mon Sep 17 00:00:00 2001 From: ymqytw Date: Wed, 19 Jul 2017 13:19:12 -0700 Subject: [PATCH 2/3] update godep --- Godeps/Godeps.json | 41 +- Godeps/LICENSES | 420 ++++++++++++++++++ cmd/kube-proxy/app/BUILD | 2 +- cmd/kubemark/BUILD | 2 +- pkg/cloudprovider/providers/openstack/BUILD | 2 +- pkg/kubectl/cmd/BUILD | 2 +- pkg/kubectl/cmd/util/BUILD | 4 +- pkg/kubelet/BUILD | 2 +- pkg/kubelet/dockershim/BUILD | 2 +- pkg/kubelet/dockershim/remote/BUILD | 2 +- pkg/kubelet/network/BUILD | 2 +- pkg/kubelet/network/cni/BUILD | 5 +- pkg/kubelet/network/hairpin/BUILD | 7 +- pkg/kubelet/network/kubenet/BUILD | 5 +- pkg/kubelet/prober/BUILD | 4 +- pkg/kubelet/remote/BUILD | 2 +- pkg/kubelet/rkt/BUILD | 5 +- pkg/kubelet/server/remotecommand/BUILD | 2 +- pkg/kubemark/BUILD | 2 +- pkg/probe/exec/BUILD | 2 +- pkg/proxy/iptables/BUILD | 5 +- pkg/proxy/userspace/BUILD | 5 +- pkg/proxy/util/BUILD | 7 +- pkg/proxy/winuserspace/BUILD | 2 +- pkg/util/BUILD | 1 - pkg/util/bandwidth/BUILD | 5 +- pkg/util/ebtables/BUILD | 7 +- pkg/util/exec/exec_test.go | 103 ----- pkg/util/ipconfig/BUILD | 4 +- pkg/util/iptables/BUILD | 5 +- pkg/util/mount/BUILD | 7 +- pkg/util/netsh/BUILD | 2 +- pkg/volume/aws_ebs/BUILD | 2 +- pkg/volume/azure_dd/BUILD | 5 +- pkg/volume/cinder/BUILD | 2 +- pkg/volume/fc/BUILD | 2 +- pkg/volume/flexvolume/BUILD | 5 +- pkg/volume/gce_pd/BUILD | 2 +- pkg/volume/git_repo/BUILD | 5 +- pkg/volume/glusterfs/BUILD | 5 +- pkg/volume/iscsi/BUILD | 2 +- pkg/volume/nfs/BUILD | 2 +- pkg/volume/photon_pd/BUILD | 2 +- pkg/volume/portworx/BUILD | 2 +- pkg/volume/quobyte/BUILD | 2 +- pkg/volume/rbd/BUILD | 2 +- pkg/volume/scaleio/BUILD | 2 +- pkg/volume/storageos/BUILD | 2 +- pkg/volume/vsphere_volume/BUILD | 2 +- test/e2e/framework/BUILD | 2 +- test/e2e/kubectl/BUILD | 2 +- vendor/BUILD | 1 + vendor/k8s.io/utils/LICENSE | 202 +++++++++ {pkg/util => vendor/k8s.io/utils}/exec/BUILD | 14 +- {pkg/util => vendor/k8s.io/utils}/exec/doc.go | 4 +- .../util => vendor/k8s.io/utils}/exec/exec.go | 12 +- vendor/k8s.io/utils/exec/testing/BUILD | 28 ++ .../k8s.io/utils/exec/testing}/fake_exec.go | 24 +- 58 files changed, 792 insertions(+), 211 deletions(-) delete mode 100644 pkg/util/exec/exec_test.go create mode 100644 vendor/k8s.io/utils/LICENSE rename {pkg/util => vendor/k8s.io/utils}/exec/BUILD (69%) rename {pkg/util => vendor/k8s.io/utils}/exec/doc.go (86%) rename {pkg/util => vendor/k8s.io/utils}/exec/exec.go (94%) create mode 100644 vendor/k8s.io/utils/exec/testing/BUILD rename {pkg/util/exec => vendor/k8s.io/utils/exec/testing}/fake_exec.go (85%) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 7d6b2a7721..5b026bc5c7 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -2147,82 +2147,82 @@ }, { "ImportPath": "github.com/opencontainers/runc/libcontainer", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/apparmor", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups/fs", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups/systemd", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/configs", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/configs/validate", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/criurpc", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/keys", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/label", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/seccomp", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/selinux", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/stacktrace", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/system", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/user", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { "ImportPath": "github.com/opencontainers/runc/libcontainer/utils", - "Comment": "v1.0.0-rc2-49-gd223e2a", + "Comment": "v1.0.0-rc2-49-gd223e2ad", "Rev": "d223e2adae83f62d58448a799a5da05730228089" }, { @@ -2231,6 +2231,7 @@ }, { "ImportPath": "github.com/pelletier/go-buffruneio", + "Comment": "v0.1.0", "Rev": "df1e16fde7fc330a0ca68167c23bf7ed6ac31d6d" }, { @@ -3027,6 +3028,14 @@ "Comment": "v1.2.0-beta.1", "Rev": "c2ac40f1adf8c42a79badddb2a2acd673cae3bcb" }, + { + "ImportPath": "k8s.io/utils/exec", + "Rev": "9fdc871a36f37980dd85f96d576b20d564cc0784" + }, + { + "ImportPath": "k8s.io/utils/exec/testing", + "Rev": "9fdc871a36f37980dd85f96d576b20d564cc0784" + }, { "ImportPath": "vbom.ml/util/sortorder", "Rev": "db5cfe13f5cc80a4990d98e2e1b0707a4d1a5394" diff --git a/Godeps/LICENSES b/Godeps/LICENSES index b3ccbe68fd..07323c3539 100644 --- a/Godeps/LICENSES +++ b/Godeps/LICENSES @@ -90143,6 +90143,426 @@ Apache License ================================================================================ +================================================================================ += vendor/k8s.io/utils/exec licensed under: = + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + += vendor/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 - +================================================================================ + + +================================================================================ += vendor/k8s.io/utils/exec/testing licensed under: = + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + += vendor/k8s.io/utils/LICENSE 3b83ef96387f14655fc854ddc3c6bd57 - +================================================================================ + + ================================================================================ = vendor/vbom.ml/util/sortorder licensed under: = diff --git a/cmd/kube-proxy/app/BUILD b/cmd/kube-proxy/app/BUILD index 51fb1cb62e..31f56757d4 100644 --- a/cmd/kube-proxy/app/BUILD +++ b/cmd/kube-proxy/app/BUILD @@ -32,7 +32,6 @@ go_library( "//pkg/proxy/winuserspace:go_default_library", "//pkg/util/configz:go_default_library", "//pkg/util/dbus:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/netsh:go_default_library", @@ -62,6 +61,7 @@ go_library( "//vendor/k8s.io/client-go/tools/clientcmd:go_default_library", "//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library", "//vendor/k8s.io/client-go/tools/record:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/cmd/kubemark/BUILD b/cmd/kubemark/BUILD index 0e68e8f0ce..63364f941e 100644 --- a/cmd/kubemark/BUILD +++ b/cmd/kubemark/BUILD @@ -26,7 +26,6 @@ go_library( "//pkg/kubelet/cm:go_default_library", "//pkg/kubelet/dockershim/libdocker:go_default_library", "//pkg/kubemark:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables/testing:go_default_library", "//pkg/util/sysctl/testing:go_default_library", "//pkg/version/prometheus:go_default_library", @@ -39,6 +38,7 @@ go_library( "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/k8s.io/client-go/tools/clientcmd:go_default_library", "//vendor/k8s.io/client-go/tools/record:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/cloudprovider/providers/openstack/BUILD b/pkg/cloudprovider/providers/openstack/BUILD index 7d4ddbce5d..a3eff15c99 100644 --- a/pkg/cloudprovider/providers/openstack/BUILD +++ b/pkg/cloudprovider/providers/openstack/BUILD @@ -26,7 +26,6 @@ go_library( "//pkg/api/v1/service:go_default_library", "//pkg/cloudprovider:go_default_library", "//pkg/controller:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/volume:go_default_library", "//vendor/github.com/golang/glog:go_default_library", @@ -62,6 +61,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//vendor/k8s.io/client-go/util/cert:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubectl/cmd/BUILD b/pkg/kubectl/cmd/BUILD index cf23568467..165c6aa93a 100644 --- a/pkg/kubectl/cmd/BUILD +++ b/pkg/kubectl/cmd/BUILD @@ -97,7 +97,6 @@ go_library( "//pkg/kubectl/util/term:go_default_library", "//pkg/printers:go_default_library", "//pkg/printers/internalversion:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/i18n:go_default_library", "//pkg/util/interrupt:go_default_library", "//pkg/util/taints:go_default_library", @@ -145,6 +144,7 @@ go_library( "//vendor/k8s.io/client-go/tools/portforward:go_default_library", "//vendor/k8s.io/client-go/tools/remotecommand:go_default_library", "//vendor/k8s.io/client-go/transport/spdy:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubectl/cmd/util/BUILD b/pkg/kubectl/cmd/util/BUILD index 722e7e395a..c1c1d3365b 100644 --- a/pkg/kubectl/cmd/util/BUILD +++ b/pkg/kubectl/cmd/util/BUILD @@ -42,7 +42,6 @@ go_library( "//pkg/kubectl/resource:go_default_library", "//pkg/printers:go_default_library", "//pkg/printers/internalversion:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/version:go_default_library", "//vendor/github.com/emicklei/go-restful-swagger12:go_default_library", "//vendor/github.com/evanphx/json-patch:go_default_library", @@ -73,6 +72,7 @@ go_library( "//vendor/k8s.io/client-go/rest:go_default_library", "//vendor/k8s.io/client-go/tools/clientcmd:go_default_library", "//vendor/k8s.io/client-go/util/homedir:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -106,7 +106,6 @@ go_test( "//pkg/controller:go_default_library", "//pkg/kubectl:go_default_library", "//pkg/kubectl/resource:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/emicklei/go-restful-swagger12:go_default_library", "//vendor/github.com/googleapis/gnostic/OpenAPIv2:go_default_library", "//vendor/github.com/stretchr/testify/assert:go_default_library", @@ -129,6 +128,7 @@ go_test( "//vendor/k8s.io/client-go/testing:go_default_library", "//vendor/k8s.io/client-go/tools/clientcmd:go_default_library", "//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubelet/BUILD b/pkg/kubelet/BUILD index 0bd89931e8..456e275229 100644 --- a/pkg/kubelet/BUILD +++ b/pkg/kubelet/BUILD @@ -93,7 +93,6 @@ go_library( "//pkg/security/apparmor:go_default_library", "//pkg/securitycontext:go_default_library", "//pkg/util/dbus:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/file:go_default_library", "//pkg/util/io:go_default_library", "//pkg/util/iptables:go_default_library", @@ -141,6 +140,7 @@ go_library( "//vendor/k8s.io/client-go/tools/remotecommand:go_default_library", "//vendor/k8s.io/client-go/util/flowcontrol:go_default_library", "//vendor/k8s.io/client-go/util/integer:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubelet/dockershim/BUILD b/pkg/kubelet/dockershim/BUILD index ddf3297405..d95675cd27 100644 --- a/pkg/kubelet/dockershim/BUILD +++ b/pkg/kubelet/dockershim/BUILD @@ -51,7 +51,6 @@ go_library( "//pkg/kubelet/util/cache:go_default_library", "//pkg/kubelet/util/ioutils:go_default_library", "//pkg/security/apparmor:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/hash:go_default_library", "//pkg/util/term:go_default_library", "//vendor/github.com/blang/semver:go_default_library", @@ -68,6 +67,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//vendor/k8s.io/client-go/tools/remotecommand:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubelet/dockershim/remote/BUILD b/pkg/kubelet/dockershim/remote/BUILD index 07a5b4e759..7aa94a2005 100644 --- a/pkg/kubelet/dockershim/remote/BUILD +++ b/pkg/kubelet/dockershim/remote/BUILD @@ -19,11 +19,11 @@ go_library( "//pkg/kubelet/apis/cri/v1alpha1/runtime:go_default_library", "//pkg/kubelet/dockershim:go_default_library", "//pkg/kubelet/util:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/interrupt:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/golang.org/x/net/context:go_default_library", "//vendor/google.golang.org/grpc:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubelet/network/BUILD b/pkg/kubelet/network/BUILD index c3beae781c..c7592df73d 100644 --- a/pkg/kubelet/network/BUILD +++ b/pkg/kubelet/network/BUILD @@ -18,7 +18,6 @@ go_library( "//pkg/apis/componentconfig:go_default_library", "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/network/hostport:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/sysctl:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", @@ -27,6 +26,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/validation:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubelet/network/cni/BUILD b/pkg/kubelet/network/cni/BUILD index 162eee9606..01b57ce3fe 100644 --- a/pkg/kubelet/network/cni/BUILD +++ b/pkg/kubelet/network/cni/BUILD @@ -16,10 +16,10 @@ go_library( "//pkg/apis/componentconfig:go_default_library", "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/network:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/containernetworking/cni/libcni:go_default_library", "//vendor/github.com/containernetworking/cni/pkg/types:go_default_library", "//vendor/github.com/golang/glog:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -36,12 +36,13 @@ go_test( "//pkg/kubelet/network/cni/testing:go_default_library", "//pkg/kubelet/network/hostport:go_default_library", "//pkg/kubelet/network/testing:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/containernetworking/cni/pkg/types/020:go_default_library", "//vendor/github.com/stretchr/testify/mock:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/client-go/util/testing:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/kubelet/network/hairpin/BUILD b/pkg/kubelet/network/hairpin/BUILD index 5af4f05c31..5d1ef1e55e 100644 --- a/pkg/kubelet/network/hairpin/BUILD +++ b/pkg/kubelet/network/hairpin/BUILD @@ -13,8 +13,8 @@ go_library( srcs = ["hairpin.go"], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -23,7 +23,10 @@ go_test( srcs = ["hairpin_test.go"], library = ":go_default_library", tags = ["automanaged"], - deps = ["//pkg/util/exec:go_default_library"], + deps = [ + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", + ], ) filegroup( diff --git a/pkg/kubelet/network/kubenet/BUILD b/pkg/kubelet/network/kubenet/BUILD index db329da358..20a94a3f18 100644 --- a/pkg/kubelet/network/kubenet/BUILD +++ b/pkg/kubelet/network/kubenet/BUILD @@ -23,7 +23,6 @@ go_library( "//pkg/util/bandwidth:go_default_library", "//pkg/util/dbus:go_default_library", "//pkg/util/ebtables:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/sysctl:go_default_library", "//vendor/github.com/containernetworking/cni/libcni:go_default_library", @@ -35,6 +34,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -51,11 +51,12 @@ go_test( "//pkg/kubelet/network/hostport/testing:go_default_library", "//pkg/kubelet/network/testing:go_default_library", "//pkg/util/bandwidth:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables/testing:go_default_library", "//pkg/util/sysctl/testing:go_default_library", "//vendor/github.com/stretchr/testify/assert:go_default_library", "//vendor/github.com/stretchr/testify/mock:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/kubelet/prober/BUILD b/pkg/kubelet/prober/BUILD index ae83d43a34..4019666b30 100644 --- a/pkg/kubelet/prober/BUILD +++ b/pkg/kubelet/prober/BUILD @@ -27,7 +27,6 @@ go_library( "//pkg/probe/exec:go_default_library", "//pkg/probe/http:go_default_library", "//pkg/probe/tcp:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", @@ -36,6 +35,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//vendor/k8s.io/client-go/tools/record:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -58,7 +58,6 @@ go_test( "//pkg/kubelet/status/testing:go_default_library", "//pkg/probe:go_default_library", "//pkg/probe/exec:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -68,6 +67,7 @@ go_test( "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//vendor/k8s.io/client-go/kubernetes/fake:go_default_library", "//vendor/k8s.io/client-go/tools/record:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubelet/remote/BUILD b/pkg/kubelet/remote/BUILD index 19da135ed5..59b1e149be 100644 --- a/pkg/kubelet/remote/BUILD +++ b/pkg/kubelet/remote/BUILD @@ -20,10 +20,10 @@ go_library( "//pkg/kubelet/apis/cri:go_default_library", "//pkg/kubelet/apis/cri/v1alpha1/runtime:go_default_library", "//pkg/kubelet/util:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/golang.org/x/net/context:go_default_library", "//vendor/google.golang.org/grpc:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubelet/rkt/BUILD b/pkg/kubelet/rkt/BUILD index 33f8ca2a86..da2cd6969f 100644 --- a/pkg/kubelet/rkt/BUILD +++ b/pkg/kubelet/rkt/BUILD @@ -35,7 +35,6 @@ go_library( "//pkg/kubelet/types:go_default_library", "//pkg/kubelet/util/format:go_default_library", "//pkg/securitycontext:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/parsers:go_default_library", "//pkg/util/selinux:go_default_library", "//pkg/util/strings:go_default_library", @@ -59,6 +58,7 @@ go_library( "//vendor/k8s.io/client-go/tools/record:go_default_library", "//vendor/k8s.io/client-go/tools/remotecommand:go_default_library", "//vendor/k8s.io/client-go/util/flowcontrol:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -78,7 +78,6 @@ go_test( "//pkg/kubelet/network/kubenet:go_default_library", "//pkg/kubelet/network/testing:go_default_library", "//pkg/kubelet/types:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/appc/spec/schema:go_default_library", "//vendor/github.com/appc/spec/schema/types:go_default_library", "//vendor/github.com/coreos/go-systemd/dbus:go_default_library", @@ -94,6 +93,8 @@ go_test( "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//vendor/k8s.io/client-go/util/testing:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/kubelet/server/remotecommand/BUILD b/pkg/kubelet/server/remotecommand/BUILD index dd350d0651..22517fdd38 100644 --- a/pkg/kubelet/server/remotecommand/BUILD +++ b/pkg/kubelet/server/remotecommand/BUILD @@ -19,7 +19,6 @@ go_library( tags = ["automanaged"], deps = [ "//pkg/api:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", @@ -31,6 +30,7 @@ go_library( "//vendor/k8s.io/apiserver/pkg/server/httplog:go_default_library", "//vendor/k8s.io/apiserver/pkg/util/wsstream:go_default_library", "//vendor/k8s.io/client-go/tools/remotecommand:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/kubemark/BUILD b/pkg/kubemark/BUILD index 6a6e4a8a27..1831c1c839 100644 --- a/pkg/kubemark/BUILD +++ b/pkg/kubemark/BUILD @@ -31,7 +31,6 @@ go_library( "//pkg/proxy:go_default_library", "//pkg/proxy/config:go_default_library", "//pkg/proxy/iptables:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/io:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/mount:go_default_library", @@ -49,6 +48,7 @@ go_library( "//vendor/k8s.io/client-go/kubernetes:go_default_library", "//vendor/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library", "//vendor/k8s.io/client-go/tools/record:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/probe/exec/BUILD b/pkg/probe/exec/BUILD index f9b2e4d42b..7cea1c092f 100644 --- a/pkg/probe/exec/BUILD +++ b/pkg/probe/exec/BUILD @@ -14,8 +14,8 @@ go_library( tags = ["automanaged"], deps = [ "//pkg/probe:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/proxy/iptables/BUILD b/pkg/proxy/iptables/BUILD index d123f768d8..3168a71c2c 100644 --- a/pkg/proxy/iptables/BUILD +++ b/pkg/proxy/iptables/BUILD @@ -24,7 +24,6 @@ go_library( "//pkg/proxy/healthcheck:go_default_library", "//pkg/proxy/util:go_default_library", "//pkg/util/async:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/sysctl:go_default_library", "//pkg/util/version:go_default_library", @@ -36,6 +35,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//vendor/k8s.io/apiserver/pkg/util/feature:go_default_library", "//vendor/k8s.io/client-go/tools/record:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -48,7 +48,6 @@ go_test( "//pkg/api:go_default_library", "//pkg/proxy:go_default_library", "//pkg/util/async:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/iptables/testing:go_default_library", "//vendor/github.com/davecgh/go-spew/spew:go_default_library", @@ -56,6 +55,8 @@ go_test( "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/proxy/userspace/BUILD b/pkg/proxy/userspace/BUILD index 8c534022b0..fab02e9ce2 100644 --- a/pkg/proxy/userspace/BUILD +++ b/pkg/proxy/userspace/BUILD @@ -25,7 +25,6 @@ go_library( "//pkg/api/helper:go_default_library", "//pkg/proxy:go_default_library", "//pkg/proxy/util:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables:go_default_library", "//pkg/util/slice:go_default_library", "//vendor/github.com/golang/glog:go_default_library", @@ -35,6 +34,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -50,12 +50,13 @@ go_test( deps = [ "//pkg/api:go_default_library", "//pkg/proxy:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/iptables/testing:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/proxy/util/BUILD b/pkg/proxy/util/BUILD index 5687247962..44a8bd1a3a 100644 --- a/pkg/proxy/util/BUILD +++ b/pkg/proxy/util/BUILD @@ -13,8 +13,8 @@ go_library( srcs = ["conntrack.go"], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -23,7 +23,10 @@ go_test( srcs = ["conntrack_test.go"], library = ":go_default_library", tags = ["automanaged"], - deps = ["//pkg/util/exec:go_default_library"], + deps = [ + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", + ], ) filegroup( diff --git a/pkg/proxy/winuserspace/BUILD b/pkg/proxy/winuserspace/BUILD index 06563e1eef..45abb77fdb 100644 --- a/pkg/proxy/winuserspace/BUILD +++ b/pkg/proxy/winuserspace/BUILD @@ -23,7 +23,6 @@ go_library( "//pkg/api:go_default_library", "//pkg/api/helper:go_default_library", "//pkg/proxy:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/ipconfig:go_default_library", "//pkg/util/netsh:go_default_library", "//pkg/util/slice:go_default_library", @@ -32,6 +31,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/runtime:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/util/BUILD b/pkg/util/BUILD index d98f2641dc..e81de7cd0f 100644 --- a/pkg/util/BUILD +++ b/pkg/util/BUILD @@ -20,7 +20,6 @@ filegroup( "//pkg/util/dbus:all-srcs", "//pkg/util/ebtables:all-srcs", "//pkg/util/env:all-srcs", - "//pkg/util/exec:all-srcs", "//pkg/util/file:all-srcs", "//pkg/util/flock:all-srcs", "//pkg/util/goroutinemap:all-srcs", diff --git a/pkg/util/bandwidth/BUILD b/pkg/util/bandwidth/BUILD index ee8ca8af46..7b8676c7f1 100644 --- a/pkg/util/bandwidth/BUILD +++ b/pkg/util/bandwidth/BUILD @@ -19,10 +19,10 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -36,9 +36,10 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/api:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/util/ebtables/BUILD b/pkg/util/ebtables/BUILD index e6ba7acdc2..cb8e66850b 100644 --- a/pkg/util/ebtables/BUILD +++ b/pkg/util/ebtables/BUILD @@ -12,7 +12,7 @@ go_library( name = "go_default_library", srcs = ["ebtables.go"], tags = ["automanaged"], - deps = ["//pkg/util/exec:go_default_library"], + deps = ["//vendor/k8s.io/utils/exec:go_default_library"], ) go_test( @@ -20,7 +20,10 @@ go_test( srcs = ["ebtables_test.go"], library = ":go_default_library", tags = ["automanaged"], - deps = ["//pkg/util/exec:go_default_library"], + deps = [ + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", + ], ) filegroup( diff --git a/pkg/util/exec/exec_test.go b/pkg/util/exec/exec_test.go deleted file mode 100644 index 8b22d324c0..0000000000 --- a/pkg/util/exec/exec_test.go +++ /dev/null @@ -1,103 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package exec - -import ( - osexec "os/exec" - "testing" -) - -func TestExecutorNoArgs(t *testing.T) { - ex := New() - - cmd := ex.Command("true") - out, err := cmd.CombinedOutput() - if err != nil { - t.Errorf("expected success, got %v", err) - } - if len(out) != 0 { - t.Errorf("expected no output, got %q", string(out)) - } - - cmd = ex.Command("false") - out, err = cmd.CombinedOutput() - if err == nil { - t.Errorf("expected failure, got nil error") - } - if len(out) != 0 { - t.Errorf("expected no output, got %q", string(out)) - } - ee, ok := err.(ExitError) - if !ok { - t.Errorf("expected an ExitError, got %+v", err) - } - if ee.Exited() { - if code := ee.ExitStatus(); code != 1 { - t.Errorf("expected exit status 1, got %d", code) - } - } - - cmd = ex.Command("/does/not/exist") - out, err = cmd.CombinedOutput() - if err == nil { - t.Errorf("expected failure, got nil error") - } - if ee, ok := err.(ExitError); ok { - t.Errorf("expected non-ExitError, got %+v", ee) - } -} - -func TestExecutorWithArgs(t *testing.T) { - ex := New() - - cmd := ex.Command("echo", "stdout") - out, err := cmd.CombinedOutput() - if err != nil { - t.Errorf("expected success, got %+v", err) - } - if string(out) != "stdout\n" { - t.Errorf("unexpected output: %q", string(out)) - } - - cmd = ex.Command("/bin/sh", "-c", "echo stderr > /dev/stderr") - out, err = cmd.CombinedOutput() - if err != nil { - t.Errorf("expected success, got %+v", err) - } - if string(out) != "stderr\n" { - t.Errorf("unexpected output: %q", string(out)) - } -} - -func TestLookPath(t *testing.T) { - ex := New() - - shExpected, _ := osexec.LookPath("sh") - sh, _ := ex.LookPath("sh") - if sh != shExpected { - t.Errorf("unexpected result for LookPath: got %s, expected %s", sh, shExpected) - } -} - -func TestExecutableNotFound(t *testing.T) { - exec := New() - cmd := exec.Command("fake_executable_name") - _, err := cmd.CombinedOutput() - if err != ErrExecutableNotFound { - t.Errorf("Expected error ErrExecutableNotFound but got %v", err) - } -} diff --git a/pkg/util/ipconfig/BUILD b/pkg/util/ipconfig/BUILD index 4776c592a5..f9c248951c 100644 --- a/pkg/util/ipconfig/BUILD +++ b/pkg/util/ipconfig/BUILD @@ -16,8 +16,8 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -26,7 +26,7 @@ go_test( srcs = ["ipconfig_test.go"], library = ":go_default_library", tags = ["automanaged"], - deps = ["//pkg/util/exec:go_default_library"], + deps = ["//vendor/k8s.io/utils/exec:go_default_library"], ) filegroup( diff --git a/pkg/util/iptables/BUILD b/pkg/util/iptables/BUILD index c688e303ba..276e464cd9 100644 --- a/pkg/util/iptables/BUILD +++ b/pkg/util/iptables/BUILD @@ -19,7 +19,6 @@ go_library( tags = ["automanaged"], deps = [ "//pkg/util/dbus:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/version:go_default_library", "//vendor/github.com/godbus/dbus:go_default_library", "//vendor/github.com/golang/glog:go_default_library", @@ -27,6 +26,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/errors:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -37,8 +37,9 @@ go_test( tags = ["automanaged"], deps = [ "//pkg/util/dbus:go_default_library", - "//pkg/util/exec:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/util/mount/BUILD b/pkg/util/mount/BUILD index 906c610f98..0c96fe6269 100644 --- a/pkg/util/mount/BUILD +++ b/pkg/util/mount/BUILD @@ -19,9 +19,9 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -33,7 +33,10 @@ go_test( ], library = ":go_default_library", tags = ["automanaged"], - deps = ["//pkg/util/exec:go_default_library"], + deps = [ + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", + ], ) filegroup( diff --git a/pkg/util/netsh/BUILD b/pkg/util/netsh/BUILD index 7a704d5c49..aad5d109a5 100644 --- a/pkg/util/netsh/BUILD +++ b/pkg/util/netsh/BUILD @@ -15,8 +15,8 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//vendor/github.com/golang/glog:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/aws_ebs/BUILD b/pkg/volume/aws_ebs/BUILD index b3e126102d..f5146d16c2 100644 --- a/pkg/volume/aws_ebs/BUILD +++ b/pkg/volume/aws_ebs/BUILD @@ -20,7 +20,6 @@ go_library( deps = [ "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers/aws:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -31,6 +30,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/azure_dd/BUILD b/pkg/volume/azure_dd/BUILD index a60cb736fe..4a83820bba 100644 --- a/pkg/volume/azure_dd/BUILD +++ b/pkg/volume/azure_dd/BUILD @@ -22,7 +22,6 @@ go_library( "//pkg/api:go_default_library", "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers/azure:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", @@ -37,6 +36,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -62,10 +62,11 @@ go_test( library = ":go_default_library", tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/testing:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/client-go/util/testing:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/volume/cinder/BUILD b/pkg/volume/cinder/BUILD index b1594b5a56..7171735ea1 100644 --- a/pkg/volume/cinder/BUILD +++ b/pkg/volume/cinder/BUILD @@ -22,7 +22,6 @@ go_library( "//pkg/cloudprovider/providers/openstack:go_default_library", "//pkg/cloudprovider/providers/rackspace:go_default_library", "//pkg/kubelet/apis:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", @@ -37,6 +36,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/wait:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/fc/BUILD b/pkg/volume/fc/BUILD index 43be4c5f7e..09e8d9a561 100644 --- a/pkg/volume/fc/BUILD +++ b/pkg/volume/fc/BUILD @@ -19,7 +19,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -27,6 +26,7 @@ go_library( "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/flexvolume/BUILD b/pkg/volume/flexvolume/BUILD index c743d8fb02..ff746d60cc 100644 --- a/pkg/volume/flexvolume/BUILD +++ b/pkg/volume/flexvolume/BUILD @@ -28,7 +28,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -36,6 +35,7 @@ go_library( "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -53,7 +53,6 @@ go_test( library = ":go_default_library", tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/testing:go_default_library", @@ -61,6 +60,8 @@ go_test( "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/client-go/util/testing:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/volume/gce_pd/BUILD b/pkg/volume/gce_pd/BUILD index 3323a63398..1282d7a674 100644 --- a/pkg/volume/gce_pd/BUILD +++ b/pkg/volume/gce_pd/BUILD @@ -20,7 +20,6 @@ go_library( deps = [ "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers/gce:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -32,6 +31,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/git_repo/BUILD b/pkg/volume/git_repo/BUILD index 7277e1ab05..2bf3b257f7 100644 --- a/pkg/volume/git_repo/BUILD +++ b/pkg/volume/git_repo/BUILD @@ -16,12 +16,12 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -31,13 +31,14 @@ go_test( library = ":go_default_library", tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/empty_dir:go_default_library", "//pkg/volume/testing:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/volume/glusterfs/BUILD b/pkg/volume/glusterfs/BUILD index a19e2e1b2d..081e5b6caf 100644 --- a/pkg/volume/glusterfs/BUILD +++ b/pkg/volume/glusterfs/BUILD @@ -19,7 +19,6 @@ go_library( tags = ["automanaged"], deps = [ "//pkg/api/v1/helper:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -35,6 +34,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/labels:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) @@ -47,7 +47,6 @@ go_test( library = ":go_default_library", tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/testing:go_default_library", @@ -59,6 +58,8 @@ go_test( "//vendor/k8s.io/client-go/kubernetes/fake:go_default_library", "//vendor/k8s.io/client-go/testing:go_default_library", "//vendor/k8s.io/client-go/util/testing:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", + "//vendor/k8s.io/utils/exec/testing:go_default_library", ], ) diff --git a/pkg/volume/iscsi/BUILD b/pkg/volume/iscsi/BUILD index 03cc779b88..a3573775a0 100644 --- a/pkg/volume/iscsi/BUILD +++ b/pkg/volume/iscsi/BUILD @@ -18,7 +18,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -26,6 +25,7 @@ go_library( "//vendor/github.com/golang/glog:go_default_library", "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/nfs/BUILD b/pkg/volume/nfs/BUILD index 7555098490..41fc7be583 100644 --- a/pkg/volume/nfs/BUILD +++ b/pkg/volume/nfs/BUILD @@ -16,7 +16,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -25,6 +24,7 @@ go_library( "//vendor/k8s.io/api/core/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/photon_pd/BUILD b/pkg/volume/photon_pd/BUILD index 9cddba4587..e213563435 100644 --- a/pkg/volume/photon_pd/BUILD +++ b/pkg/volume/photon_pd/BUILD @@ -19,7 +19,6 @@ go_library( deps = [ "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers/photon:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -30,6 +29,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/portworx/BUILD b/pkg/volume/portworx/BUILD index 5261613db5..ada0894b69 100644 --- a/pkg/volume/portworx/BUILD +++ b/pkg/volume/portworx/BUILD @@ -33,7 +33,6 @@ go_library( tags = ["automanaged"], deps = [ "//pkg/api:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -48,6 +47,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/quobyte/BUILD b/pkg/volume/quobyte/BUILD index 053515e661..08baef4b44 100644 --- a/pkg/volume/quobyte/BUILD +++ b/pkg/volume/quobyte/BUILD @@ -17,7 +17,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -30,6 +29,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/rbd/BUILD b/pkg/volume/rbd/BUILD index 38fcb52b15..e88adf13f9 100644 --- a/pkg/volume/rbd/BUILD +++ b/pkg/volume/rbd/BUILD @@ -18,7 +18,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/node:go_default_library", "//pkg/util/strings:go_default_library", @@ -33,6 +32,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/uuid:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/scaleio/BUILD b/pkg/volume/scaleio/BUILD index 7369840216..505415bb19 100644 --- a/pkg/volume/scaleio/BUILD +++ b/pkg/volume/scaleio/BUILD @@ -41,7 +41,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", @@ -56,6 +55,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/apimachinery/pkg/util/uuid:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/storageos/BUILD b/pkg/volume/storageos/BUILD index e6a12d9815..2e5268c9b9 100644 --- a/pkg/volume/storageos/BUILD +++ b/pkg/volume/storageos/BUILD @@ -17,7 +17,6 @@ go_library( ], tags = ["automanaged"], deps = [ - "//pkg/util/exec:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", "//pkg/volume:go_default_library", @@ -31,6 +30,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/pkg/volume/vsphere_volume/BUILD b/pkg/volume/vsphere_volume/BUILD index 8566e85b05..452fe1ae8b 100644 --- a/pkg/volume/vsphere_volume/BUILD +++ b/pkg/volume/vsphere_volume/BUILD @@ -19,7 +19,6 @@ go_library( deps = [ "//pkg/cloudprovider:go_default_library", "//pkg/cloudprovider/providers/vsphere:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/keymutex:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/util/strings:go_default_library", @@ -31,6 +30,7 @@ go_library( "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library", "//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", "//vendor/k8s.io/apimachinery/pkg/types:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/test/e2e/framework/BUILD b/test/e2e/framework/BUILD index d330c725e9..b57c8976c3 100644 --- a/test/e2e/framework/BUILD +++ b/test/e2e/framework/BUILD @@ -70,7 +70,6 @@ go_library( "//pkg/kubelet/util/format:go_default_library", "//pkg/master/ports:go_default_library", "//pkg/ssh:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/file:go_default_library", "//pkg/util/labels:go_default_library", "//pkg/util/system:go_default_library", @@ -136,6 +135,7 @@ go_library( "//vendor/k8s.io/client-go/tools/clientcmd:go_default_library", "//vendor/k8s.io/client-go/tools/clientcmd/api:go_default_library", "//vendor/k8s.io/client-go/tools/remotecommand:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/test/e2e/kubectl/BUILD b/test/e2e/kubectl/BUILD index 33d2d47115..8a76fe4aa5 100644 --- a/test/e2e/kubectl/BUILD +++ b/test/e2e/kubectl/BUILD @@ -21,7 +21,6 @@ go_library( "//pkg/apis/batch/v2alpha1:go_default_library", "//pkg/controller:go_default_library", "//pkg/kubectl/cmd/util:go_default_library", - "//pkg/util/exec:go_default_library", "//pkg/util/version:go_default_library", "//test/e2e/framework:go_default_library", "//test/e2e/generated:go_default_library", @@ -46,6 +45,7 @@ go_library( "//vendor/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library", "//vendor/k8s.io/apiserver/pkg/registry/generic/registry:go_default_library", "//vendor/k8s.io/client-go/kubernetes:go_default_library", + "//vendor/k8s.io/utils/exec:go_default_library", ], ) diff --git a/vendor/BUILD b/vendor/BUILD index bd25f6bae2..a5ad0b1730 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -382,6 +382,7 @@ filegroup( "//vendor/k8s.io/gengo/parser:all-srcs", "//vendor/k8s.io/gengo/types:all-srcs", "//vendor/k8s.io/heapster/metrics/api/v1/types:all-srcs", + "//vendor/k8s.io/utils/exec:all-srcs", "//vendor/vbom.ml/util/sortorder:all-srcs", ], tags = ["automanaged"], diff --git a/vendor/k8s.io/utils/LICENSE b/vendor/k8s.io/utils/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/k8s.io/utils/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/pkg/util/exec/BUILD b/vendor/k8s.io/utils/exec/BUILD similarity index 69% rename from pkg/util/exec/BUILD rename to vendor/k8s.io/utils/exec/BUILD index 32f2b4ee97..fc449980ef 100644 --- a/pkg/util/exec/BUILD +++ b/vendor/k8s.io/utils/exec/BUILD @@ -5,7 +5,6 @@ licenses(["notice"]) load( "@io_bazel_rules_go//go:def.bzl", "go_library", - "go_test", ) go_library( @@ -13,18 +12,10 @@ go_library( srcs = [ "doc.go", "exec.go", - "fake_exec.go", ], tags = ["automanaged"], ) -go_test( - name = "go_default_test", - srcs = ["exec_test.go"], - library = ":go_default_library", - tags = ["automanaged"], -) - filegroup( name = "package-srcs", srcs = glob(["**"]), @@ -34,6 +25,9 @@ filegroup( filegroup( name = "all-srcs", - srcs = [":package-srcs"], + srcs = [ + ":package-srcs", + "//vendor/k8s.io/utils/exec/testing:all-srcs", + ], tags = ["automanaged"], ) diff --git a/pkg/util/exec/doc.go b/vendor/k8s.io/utils/exec/doc.go similarity index 86% rename from pkg/util/exec/doc.go rename to vendor/k8s.io/utils/exec/doc.go index de7301c8d1..7dc1e5171c 100644 --- a/pkg/util/exec/doc.go +++ b/vendor/k8s.io/utils/exec/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2014 The Kubernetes Authors. +Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -15,4 +15,4 @@ limitations under the License. */ // Package exec provides an injectable interface and implementations for running commands. -package exec // import "k8s.io/kubernetes/pkg/util/exec" +package exec diff --git a/pkg/util/exec/exec.go b/vendor/k8s.io/utils/exec/exec.go similarity index 94% rename from pkg/util/exec/exec.go rename to vendor/k8s.io/utils/exec/exec.go index f43bfa7a17..3b23eceb1c 100644 --- a/pkg/util/exec/exec.go +++ b/vendor/k8s.io/utils/exec/exec.go @@ -1,5 +1,5 @@ /* -Copyright 2014 The Kubernetes Authors. +Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import ( // ErrExecutableNotFound is returned if the executable is not found. var ErrExecutableNotFound = osexec.ErrNotFound -// Interface is an interface that presents a subset of the os/exec API. Use this +// Interface is an interface that presents a subset of the os/exec API. Use this // when you want to inject fakeable/mockable exec behavior. type Interface interface { // Command returns a Cmd instance which can be used to run a single command. @@ -38,13 +38,13 @@ type Interface interface { } // Cmd is an interface that presents an API that is very similar to Cmd from os/exec. -// As more functionality is needed, this can grow. Since Cmd is a struct, we will have +// As more functionality is needed, this can grow. Since Cmd is a struct, we will have // to replace fields with get/set method pairs. type Cmd interface { // Run runs the command to the completion. Run() error // CombinedOutput runs the command and returns its combined standard output - // and standard error. This follows the pattern of package os/exec. + // and standard error. This follows the pattern of package os/exec. CombinedOutput() ([]byte, error) // Output runs the command and returns standard output, but not standard err Output() ([]byte, error) @@ -60,7 +60,7 @@ type Cmd interface { } // ExitError is an interface that presents an API similar to os.ProcessState, which is -// what ExitError from os/exec is. This is designed to make testing a bit easier and +// what ExitError from os/exec is. This is designed to make testing a bit easier and // probably loses some of the cross-platform properties of the underlying library. type ExitError interface { String() string @@ -90,6 +90,8 @@ func (executor *executor) LookPath(file string) (string, error) { // Wraps exec.Cmd so we can capture errors. type cmdWrapper osexec.Cmd +var _ Cmd = &cmdWrapper{} + func (cmd *cmdWrapper) SetDir(dir string) { cmd.Dir = dir } diff --git a/vendor/k8s.io/utils/exec/testing/BUILD b/vendor/k8s.io/utils/exec/testing/BUILD new file mode 100644 index 0000000000..130edf6f3a --- /dev/null +++ b/vendor/k8s.io/utils/exec/testing/BUILD @@ -0,0 +1,28 @@ +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +load( + "@io_bazel_rules_go//go:def.bzl", + "go_library", +) + +go_library( + name = "go_default_library", + srcs = ["fake_exec.go"], + tags = ["automanaged"], + deps = ["//vendor/k8s.io/utils/exec:go_default_library"], +) + +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], +) diff --git a/pkg/util/exec/fake_exec.go b/vendor/k8s.io/utils/exec/testing/fake_exec.go similarity index 85% rename from pkg/util/exec/fake_exec.go rename to vendor/k8s.io/utils/exec/testing/fake_exec.go index c7fcd6cecd..d97338bf0b 100644 --- a/pkg/util/exec/fake_exec.go +++ b/vendor/k8s.io/utils/exec/testing/fake_exec.go @@ -1,5 +1,5 @@ /* -Copyright 2014 The Kubernetes Authors. +Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package exec +package testingexec import ( "fmt" "io" + + "k8s.io/utils/exec" ) // A simple scripted Interface type. @@ -28,9 +30,9 @@ type FakeExec struct { LookPathFunc func(string) (string, error) } -type FakeCommandAction func(cmd string, args ...string) Cmd +type FakeCommandAction func(cmd string, args ...string) exec.Cmd -func (fake *FakeExec) Command(cmd string, args ...string) Cmd { +func (fake *FakeExec) Command(cmd string, args ...string) exec.Cmd { if fake.CommandCalls > len(fake.CommandScript)-1 { panic(fmt.Sprintf("ran out of Command() actions. Could not handle command [%d]: %s args: %v", fake.CommandCalls, cmd, args)) } @@ -58,7 +60,9 @@ type FakeCmd struct { Stderr io.Writer } -func InitFakeCmd(fake *FakeCmd, cmd string, args ...string) Cmd { +var _ exec.Cmd = &FakeCmd{} + +func InitFakeCmd(fake *FakeCmd, cmd string, args ...string) exec.Cmd { fake.Argv = append([]string{cmd}, args...) return fake } @@ -128,18 +132,20 @@ type FakeExitError struct { Status int } -func (fake *FakeExitError) String() string { +var _ exec.ExitError = FakeExitError{} + +func (fake FakeExitError) String() string { return fmt.Sprintf("exit %d", fake.Status) } -func (fake *FakeExitError) Error() string { +func (fake FakeExitError) Error() string { return fake.String() } -func (fake *FakeExitError) Exited() bool { +func (fake FakeExitError) Exited() bool { return true } -func (fake *FakeExitError) ExitStatus() int { +func (fake FakeExitError) ExitStatus() int { return fake.Status } From aa557c1028f113ca5a11c2a645092ba086533a77 Mon Sep 17 00:00:00 2001 From: ymqytw Date: Wed, 19 Jul 2017 16:05:50 -0700 Subject: [PATCH 3/3] fix golint --- hack/.golint_failures | 1 - 1 file changed, 1 deletion(-) diff --git a/hack/.golint_failures b/hack/.golint_failures index c3ce5dca59..b612ffc0e1 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -428,7 +428,6 @@ pkg/util/configz pkg/util/dbus pkg/util/ebtables pkg/util/env -pkg/util/exec pkg/util/file pkg/util/goroutinemap/exponentialbackoff pkg/util/initsystem