diff --git a/pkg/kubelet/network/exec/exec.go b/pkg/kubelet/network/exec/exec.go index feddebb0c7b..522dbd50b7b 100644 --- a/pkg/kubelet/network/exec/exec.go +++ b/pkg/kubelet/network/exec/exec.go @@ -53,7 +53,6 @@ import ( "io/ioutil" "path" "strings" - "syscall" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/network" @@ -72,7 +71,6 @@ const ( setUpCmd = "setup" tearDownCmd = "teardown" execDir = "/usr/libexec/kubernetes/kubelet-plugins/net/exec/" - X_OK = 0x1 ) func ProbeNetworkPlugins() []network.NetworkPlugin { @@ -120,7 +118,7 @@ func (plugin *execNetworkPlugin) Name() string { } func (plugin *execNetworkPlugin) validate() error { - if syscall.Access(plugin.getExecutable(), X_OK) != nil { + if !isExecutable(plugin.getExecutable()) { errStr := fmt.Sprintf("Invalid exec plugin. Executable '%s' does not have correct permissions.", plugin.execName) return errors.New(errStr) } diff --git a/pkg/kubelet/network/exec/exec_unix.go b/pkg/kubelet/network/exec/exec_unix.go new file mode 100644 index 00000000000..e843a7a966d --- /dev/null +++ b/pkg/kubelet/network/exec/exec_unix.go @@ -0,0 +1,27 @@ +// +build !windows + +/* +Copyright 2015 Google Inc. All rights reserved. + +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 "syscall" + +const X_OK = 0x1 + +func isExecutable(path string) bool { + return syscall.Access(path, X_OK) == nil +} diff --git a/pkg/kubelet/network/exec/exec_unsupported.go b/pkg/kubelet/network/exec/exec_unsupported.go new file mode 100644 index 00000000000..04b8ddbccfe --- /dev/null +++ b/pkg/kubelet/network/exec/exec_unsupported.go @@ -0,0 +1,23 @@ +// +build windows + +/* +Copyright 2015 Google Inc. All rights reserved. + +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 + +func isExecutable(path string) bool { + return false +}