mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	run grep-sed
This commit is contained in:
		@@ -667,7 +667,7 @@ func runPatchTest(c *client.Client) {
 | 
			
		||||
		glog.Fatalf("Failed creating patchservice: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	patchBodies := map[string]map[api.PatchType]struct {
 | 
			
		||||
	patchBodies := map[string]map[unversioned.PatchType]struct {
 | 
			
		||||
		AddLabelBody        []byte
 | 
			
		||||
		RemoveLabelBody     []byte
 | 
			
		||||
		RemoveAllLabelsBody []byte
 | 
			
		||||
@@ -693,7 +693,7 @@ func runPatchTest(c *client.Client) {
 | 
			
		||||
 | 
			
		||||
	pb := patchBodies[c.APIVersion()]
 | 
			
		||||
 | 
			
		||||
	execPatch := func(pt api.PatchType, body []byte) error {
 | 
			
		||||
	execPatch := func(pt unversioned.PatchType, body []byte) error {
 | 
			
		||||
		return c.Patch(pt).
 | 
			
		||||
			Resource(resource).
 | 
			
		||||
			Namespace(api.NamespaceDefault).
 | 
			
		||||
 
 | 
			
		||||
@@ -481,7 +481,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
 | 
			
		||||
				Operation("patch"+namespaced+kind+strings.Title(subresource)).
 | 
			
		||||
				Produces(append(storageMeta.ProducesMIMETypes(action.Verb), "application/json")...).
 | 
			
		||||
				Returns(http.StatusOK, "OK", versionedObject).
 | 
			
		||||
				Reads(api.Patch{}).
 | 
			
		||||
				Reads(unversioned.Patch{}).
 | 
			
		||||
				Writes(versionedObject)
 | 
			
		||||
			addParams(route, action.Params)
 | 
			
		||||
			ws.Route(route)
 | 
			
		||||
 
 | 
			
		||||
@@ -41,6 +41,6 @@ func IndexHandler(container *restful.Container, muxHelper *MuxHelper) func(http.
 | 
			
		||||
		// Extract the paths handled using mux handler.
 | 
			
		||||
		handledPaths = append(handledPaths, muxHelper.RegisteredPaths...)
 | 
			
		||||
		sort.Strings(handledPaths)
 | 
			
		||||
		writeRawJSON(status, api.RootPaths{Paths: handledPaths}, w)
 | 
			
		||||
		writeRawJSON(status, unversioned.RootPaths{Paths: handledPaths}, w)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -407,7 +407,7 @@ func PatchResource(r rest.Patcher, scope RequestScope, typer runtime.ObjectTyper
 | 
			
		||||
		if idx := strings.Index(contentType, ";"); idx > 0 {
 | 
			
		||||
			contentType = contentType[:idx]
 | 
			
		||||
		}
 | 
			
		||||
		patchType := api.PatchType(contentType)
 | 
			
		||||
		patchType := unversioned.PatchType(contentType)
 | 
			
		||||
 | 
			
		||||
		patchJS, err := readBody(req.Request)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
@@ -432,7 +432,7 @@ func PatchResource(r rest.Patcher, scope RequestScope, typer runtime.ObjectTyper
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// patchResource divides PatchResource for easier unit testing
 | 
			
		||||
func patchResource(ctx api.Context, timeout time.Duration, versionedObj runtime.Object, patcher rest.Patcher, name string, patchType api.PatchType, patchJS []byte, namer ScopeNamer, codec runtime.Codec) (runtime.Object, error) {
 | 
			
		||||
func patchResource(ctx api.Context, timeout time.Duration, versionedObj runtime.Object, patcher rest.Patcher, name string, patchType unversioned.PatchType, patchJS []byte, namer ScopeNamer, codec runtime.Codec) (runtime.Object, error) {
 | 
			
		||||
	namespace := api.NamespaceValue(ctx)
 | 
			
		||||
 | 
			
		||||
	original, err := patcher.Get(ctx, name)
 | 
			
		||||
@@ -806,7 +806,7 @@ func setListSelfLink(obj runtime.Object, req *restful.Request, namer ScopeNamer)
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getPatchedJS(patchType api.PatchType, originalJS, patchJS []byte, obj runtime.Object) ([]byte, error) {
 | 
			
		||||
func getPatchedJS(patchType unversioned.PatchType, originalJS, patchJS []byte, obj runtime.Object) ([]byte, error) {
 | 
			
		||||
	switch patchType {
 | 
			
		||||
	case api.JSONPatchType:
 | 
			
		||||
		patchObj, err := jsonpatch.DecodePatch(patchJS)
 | 
			
		||||
 
 | 
			
		||||
@@ -169,7 +169,7 @@ func (tc *patchTestCase) Run(t *testing.T) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, patchType := range []api.PatchType{api.JSONPatchType, api.MergePatchType, api.StrategicMergePatchType} {
 | 
			
		||||
	for _, patchType := range []unversioned.PatchType{api.JSONPatchType, api.MergePatchType, api.StrategicMergePatchType} {
 | 
			
		||||
		// TODO SUPPORT THIS!
 | 
			
		||||
		if patchType == api.JSONPatchType {
 | 
			
		||||
			continue
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ func (c *RESTClient) Put() *unversioned.Request {
 | 
			
		||||
	return unversioned.NewRequest(c, "PUT", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *RESTClient) Patch(_ api.PatchType) *unversioned.Request {
 | 
			
		||||
func (c *RESTClient) Patch(_ unversioned.PatchType) *unversioned.Request {
 | 
			
		||||
	return unversioned.NewRequest(c, "PATCH", &url.URL{Host: "localhost"}, testapi.Default.Version(), c.Codec)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -105,7 +105,7 @@ func (c *RESTClient) Put() *Request {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Patch begins a PATCH request. Short for c.Verb("Patch").
 | 
			
		||||
func (c *RESTClient) Patch(pt api.PatchType) *Request {
 | 
			
		||||
func (c *RESTClient) Patch(pt unversioned.PatchType) *Request {
 | 
			
		||||
	return c.Verb("PATCH").SetHeader("Content-Type", string(pt))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ import (
 | 
			
		||||
type RESTClient interface {
 | 
			
		||||
	Get() *client.Request
 | 
			
		||||
	Post() *client.Request
 | 
			
		||||
	Patch(api.PatchType) *client.Request
 | 
			
		||||
	Patch(unversioned.PatchType) *client.Request
 | 
			
		||||
	Delete() *client.Request
 | 
			
		||||
	Put() *client.Request
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -131,7 +131,7 @@ func (m *Helper) Create(namespace string, modify bool, data []byte) (runtime.Obj
 | 
			
		||||
func (m *Helper) createResource(c RESTClient, resource, namespace string, data []byte) (runtime.Object, error) {
 | 
			
		||||
	return c.Post().NamespaceIfScoped(namespace, m.NamespaceScoped).Resource(resource).Body(data).Do().Get()
 | 
			
		||||
}
 | 
			
		||||
func (m *Helper) Patch(namespace, name string, pt api.PatchType, data []byte) (runtime.Object, error) {
 | 
			
		||||
func (m *Helper) Patch(namespace, name string, pt unversioned.PatchType, data []byte) (runtime.Object, error) {
 | 
			
		||||
	return m.RESTClient.Patch(pt).
 | 
			
		||||
		NamespaceIfScoped(namespace, m.NamespaceScoped).
 | 
			
		||||
		Resource(m.Resource).
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ import (
 | 
			
		||||
type RESTClient interface {
 | 
			
		||||
	Get() *client.Request
 | 
			
		||||
	Post() *client.Request
 | 
			
		||||
	Patch(api.PatchType) *client.Request
 | 
			
		||||
	Patch(unversioned.PatchType) *client.Request
 | 
			
		||||
	Delete() *client.Request
 | 
			
		||||
	Put() *client.Request
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user