kubeval
kubeval copied to clipboard
Kubeval doesn't work correctly with xargs
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
.
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