mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 03:33:26 +00:00
Ignore empty objects from streams and error when nothing passed to create
Passing zero objects to create should be an error
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package resource
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -356,6 +357,10 @@ func (v *StreamVisitor) Visit(fn VisitorFunc) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
ext.RawJSON = bytes.TrimSpace(ext.RawJSON)
|
||||
if len(ext.RawJSON) == 0 || bytes.Equal(ext.RawJSON, []byte("null")) {
|
||||
continue
|
||||
}
|
||||
info, err := v.InfoForData(ext.RawJSON, v.Source)
|
||||
if err != nil {
|
||||
if v.IgnoreErrors {
|
||||
|
Reference in New Issue
Block a user