kubeval icon indicating copy to clipboard operation
kubeval copied to clipboard

Kubeval doesn't work correctly with xargs

Open ahawkins opened this issue 5 years ago • 1 comments

kubeval incorrectly reads from stdin when used with xargs. Here's an example:

$ echo "foo.txt" > files.txt
$ xargs kubeval < files.txt
standard input appears to be an empty document

Here's a workaround: xargs -I m sh -c 'kubeval m < /dev/stdin' < files.txt.

ahawkins avatar Sep 15 '18 10:09 ahawkins

This behavior is happening because the xargs command is reading the content of the file "files.txt" and using the kubeval command as an argument for this content, which is a string "foo.txt". However, the string "foo.txt" is not a valid document to be evaluated by kubeval. Try using it as follows:

xargs kubeval < <(cat files.txt)

It's not a bug, it's a matter of unconventional use of bash commands @garethr

scovl avatar Feb 06 '23 22:02 scovl