Remove unused chmod/chown abstractions
These abstractions have not been used since I first hacked into kubernetes, so let's just remove them and add them back if it's needed later.
This commit is contained in:
		@@ -46,8 +46,6 @@ filegroup(
 | 
				
			|||||||
        ":package-srcs",
 | 
					        ":package-srcs",
 | 
				
			||||||
        "//pkg/util/async:all-srcs",
 | 
					        "//pkg/util/async:all-srcs",
 | 
				
			||||||
        "//pkg/util/bandwidth:all-srcs",
 | 
					        "//pkg/util/bandwidth:all-srcs",
 | 
				
			||||||
        "//pkg/util/chmod:all-srcs",
 | 
					 | 
				
			||||||
        "//pkg/util/chown:all-srcs",
 | 
					 | 
				
			||||||
        "//pkg/util/config:all-srcs",
 | 
					        "//pkg/util/config:all-srcs",
 | 
				
			||||||
        "//pkg/util/configz:all-srcs",
 | 
					        "//pkg/util/configz:all-srcs",
 | 
				
			||||||
        "//pkg/util/crlf:all-srcs",
 | 
					        "//pkg/util/crlf:all-srcs",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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"],
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
@@ -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)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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"
 | 
					 | 
				
			||||||
@@ -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"],
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
@@ -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)
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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"
 | 
					 | 
				
			||||||
@@ -27,8 +27,6 @@ go_library(
 | 
				
			|||||||
        "//pkg/api/v1:go_default_library",
 | 
					        "//pkg/api/v1:go_default_library",
 | 
				
			||||||
        "//pkg/client/clientset_generated/clientset:go_default_library",
 | 
					        "//pkg/client/clientset_generated/clientset:go_default_library",
 | 
				
			||||||
        "//pkg/cloudprovider: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/io:go_default_library",
 | 
				
			||||||
        "//pkg/util/mount:go_default_library",
 | 
					        "//pkg/util/mount:go_default_library",
 | 
				
			||||||
        "//pkg/volume/util:go_default_library",
 | 
					        "//pkg/volume/util:go_default_library",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,9 +22,6 @@ import (
 | 
				
			|||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"syscall"
 | 
						"syscall"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"k8s.io/kubernetes/pkg/util/chmod"
 | 
					 | 
				
			||||||
	"k8s.io/kubernetes/pkg/util/chown"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golang/glog"
 | 
						"github.com/golang/glog"
 | 
				
			||||||
@@ -44,8 +41,6 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error {
 | 
				
			|||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	chownRunner := chown.New()
 | 
					 | 
				
			||||||
	chmodRunner := chmod.New()
 | 
					 | 
				
			||||||
	return filepath.Walk(mounter.GetPath(), func(path string, info os.FileInfo, err error) error {
 | 
						return filepath.Walk(mounter.GetPath(), func(path string, info os.FileInfo, err error) error {
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
@@ -72,7 +67,7 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error {
 | 
				
			|||||||
			return nil
 | 
								return nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = chownRunner.Chown(path, int(stat.Uid), int(*fsGroup))
 | 
							err = os.Chown(path, int(stat.Uid), int(*fsGroup))
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Chown failed on %v: %v", path, err)
 | 
								glog.Errorf("Chown failed on %v: %v", path, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -86,7 +81,7 @@ func SetVolumeOwnership(mounter Mounter, fsGroup *int64) error {
 | 
				
			|||||||
			mask |= os.ModeSetgid
 | 
								mask |= os.ModeSetgid
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = chmodRunner.Chmod(path, info.Mode()|mask)
 | 
							err = os.Chmod(path, info.Mode()|mask)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Chmod failed on %v: %v", path, err)
 | 
								glog.Errorf("Chmod failed on %v: %v", path, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user