diff --git a/pkg/util/BUILD b/pkg/util/BUILD index df0c2ab2b6..6dcbb4086b 100644 --- a/pkg/util/BUILD +++ b/pkg/util/BUILD @@ -46,8 +46,6 @@ filegroup( ":package-srcs", "//pkg/util/async:all-srcs", "//pkg/util/bandwidth:all-srcs", - "//pkg/util/chmod:all-srcs", - "//pkg/util/chown:all-srcs", "//pkg/util/config:all-srcs", "//pkg/util/configz:all-srcs", "//pkg/util/crlf:all-srcs", diff --git a/pkg/util/chmod/BUILD b/pkg/util/chmod/BUILD deleted file mode 100644 index 68d87cb5bf..0000000000 --- a/pkg/util/chmod/BUILD +++ /dev/null @@ -1,30 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = [ - "chmod.go", - "doc.go", - ], - tags = ["automanaged"], -) - -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/chmod/chmod.go b/pkg/util/chmod/chmod.go deleted file mode 100644 index d051137d0b..0000000000 --- a/pkg/util/chmod/chmod.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2015 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 chmod - -import ( - "os" -) - -// Interface is something that knows how to run the chmod system call. -// It is non-recursive. -type Interface interface { - // Chmod changes the mode of the given file, implementing the same - // semantics as os.Chmod. - Chmod(path string, filemode os.FileMode) error -} - -func New() Interface { - return &chmodRunner{} -} - -type chmodRunner struct{} - -func (_ *chmodRunner) Chmod(path string, mode os.FileMode) error { - return os.Chmod(path, mode) -} diff --git a/pkg/util/chmod/doc.go b/pkg/util/chmod/doc.go deleted file mode 100644 index 100e752f4e..0000000000 --- a/pkg/util/chmod/doc.go +++ /dev/null @@ -1,19 +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 chown provides an interface and implementations -// for things that run run the chmod system call. -package chmod // import "k8s.io/kubernetes/pkg/util/chmod" diff --git a/pkg/util/chown/BUILD b/pkg/util/chown/BUILD deleted file mode 100644 index 08de6be220..0000000000 --- a/pkg/util/chown/BUILD +++ /dev/null @@ -1,30 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -load( - "@io_bazel_rules_go//go:def.bzl", - "go_library", -) - -go_library( - name = "go_default_library", - srcs = [ - "chown.go", - "doc.go", - ], - tags = ["automanaged"], -) - -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/chown/chown.go b/pkg/util/chown/chown.go deleted file mode 100644 index 8a99084c3d..0000000000 --- a/pkg/util/chown/chown.go +++ /dev/null @@ -1,39 +0,0 @@ -/* -Copyright 2015 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 chown - -import ( - "os" -) - -// Interface is something that knows how to run the chown system call. -// It is non-recursive. -type Interface interface { - // Chown changes the owning UID and GID of a file, implementing - // the exact same semantics as os.Chown. - Chown(path string, uid, gid int) error -} - -func New() Interface { - return &chownRunner{} -} - -type chownRunner struct{} - -func (_ *chownRunner) Chown(path string, uid, gid int) error { - return os.Chown(path, uid, gid) -} diff --git a/pkg/util/chown/doc.go b/pkg/util/chown/doc.go deleted file mode 100644 index 405cda98b3..0000000000 --- a/pkg/util/chown/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2015 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 chown provides utilities to chown a path -package chown // import "k8s.io/kubernetes/pkg/util/chown" diff --git a/pkg/volume/BUILD b/pkg/volume/BUILD index 5867c11d1e..923204d37d 100644 --- a/pkg/volume/BUILD +++ b/pkg/volume/BUILD @@ -27,8 +27,6 @@ go_library( "//pkg/api/v1:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/cloudprovider:go_default_library", - "//pkg/util/chmod:go_default_library", - "//pkg/util/chown:go_default_library", "//pkg/util/io:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/volume/util:go_default_library", diff --git a/pkg/volume/volume_linux.go b/pkg/volume/volume_linux.go index d82c776724..ef1f45208c 100644 --- a/pkg/volume/volume_linux.go +++ b/pkg/volume/volume_linux.go @@ -22,9 +22,6 @@ import ( "path/filepath" "syscall" - "k8s.io/kubernetes/pkg/util/chmod" - "k8s.io/kubernetes/pkg/util/chown" - "os" "github.com/golang/glog" @@ -44,8 +41,6 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error { return nil } - chownRunner := chown.New() - chmodRunner := chmod.New() return filepath.Walk(mounter.GetPath(), func(path string, info os.FileInfo, err error) error { if err != nil { return err @@ -72,7 +67,7 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error { return nil } - err = chownRunner.Chown(path, int(stat.Uid), int(*fsGroup)) + err = os.Chown(path, int(stat.Uid), int(*fsGroup)) if err != nil { glog.Errorf("Chown failed on %v: %v", path, err) } @@ -86,7 +81,7 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error { mask |= os.ModeSetgid } - err = chmodRunner.Chmod(path, info.Mode()|mask) + err = os.Chmod(path, info.Mode()|mask) if err != nil { glog.Errorf("Chmod failed on %v: %v", path, err) }