@@ -950,46 +950,6 @@ func dryPatch(action testing.PatchActionImpl, tracker testing.ObjectTracker) (ru
950950return obj , nil
951951}
952952
953- //lint:ignore U1000 function is causing errors with status updates
954- func copyNonStatusFrom (old , new runtime.Object ) error {
955- newClientObject , ok := new .(client.Object )
956- if ! ok {
957- return fmt .Errorf ("%T is not a client.Object" , new )
958- }
959- // The only thing other than status we have to retain
960- rv := newClientObject .GetResourceVersion ()
961-
962- oldMapStringAny , err := toMapStringAny (old )
963- if err != nil {
964- return fmt .Errorf ("failed to convert old to *unstructured.Unstructured: %w" , err )
965- }
966- newMapStringAny , err := toMapStringAny (new )
967- if err != nil {
968- return fmt .Errorf ("failed to convert new to *unststructured.Unstructured: %w" , err )
969- }
970-
971- // delete everything other than status in case it has fields that were not present in
972- // the old object
973- for k := range newMapStringAny {
974- if k != "status" {
975- delete (newMapStringAny , k )
976- }
977- }
978- // copy everything other than status from the old object
979- for k := range oldMapStringAny {
980- if k != "status" {
981- newMapStringAny [k ] = oldMapStringAny [k ]
982- }
983- }
984-
985- if err := fromMapStringAny (newMapStringAny , new ); err != nil {
986- return fmt .Errorf ("failed to convert back from map[string]any: %w" , err )
987- }
988- newClientObject .SetResourceVersion (rv )
989-
990- return nil
991- }
992-
993953// copyStatusFrom copies the status from old into new
994954func copyStatusFrom (old , new runtime.Object ) error {
995955oldMapStringAny , err := toMapStringAny (old )
0 commit comments