Closed fiftydinar closed 4 months ago
Is the yq
version on your local system different than the one in the container? Our container builds use the latest version from https://hub.docker.com/r/mikefarah/yq
Maybe this feature works differently in the latest version? Might want to check piping from stdin: https://mikefarah.gitbook.io/yq/#quick-usage-guide
cat "$1" | yq '.scaling.zoom'
does not work either
cat
expects a file, try with echo
cat
expects a file, try withecho
That is expected, as I'm passing the recipe file into yq
.
That means that it's also expected that your echo
suggestion does not work in both build-time & booted-system scenario.
I just tried it, it outputs nothing.
I will try with -I=0
flag
That is expected, as I'm passing the recipe file into yq.
Why? By default the modules are provided the JSON string, you're not supposed to read module configuration from the file directly. What are you trying to accomplish?
That is expected, as I'm passing the recipe file into yq.
Why? By default the modules are provided the JSON string, you're not supposed to read module configuration from the file directly. What are you trying to accomplish?
I was just a bit confused with $1 recipe variable, so I tried cat & echo stuff.
Adding -I=0 flag solved this & now I don't get any build errors related to this.
echo "$1" | yq -I=0 '.scaling.zoom'
This page should have the proper information about this: https://blue-build.org/how-to/making-modules/#coding-your-module
I'll admit I was confused too, as I thought yq
could read from strings in the way you tried at first.
When it works
When trying to use this command on a regular system, it works:
yq '.scaling.zoom' "$1"
("$1" is the recipe yml file)When it does not work
When trying to run this command through container, it does not work & complains with this error:
For some reason, it tries to open recipe .yml content as a file.
But when manually specifying the recipe.yml location, it works:
yq '.scaling.zoom' "/tmp/config/recipe.yml"
This should not be the solution, as the recipe file is generated dynamically based on "$1" variable.
Affected .yml recipe file