When is it appropriate to use shellout in a recipe instead of bash blocks or execute? I'm inclining to using it by default for all outside calls, because of its logging, but the verbosity of the command are a disadvantage.
Asked
Active
Viewed 2,136 times
2
-
I'm thinking the intention was design something to replace execute/bash blocks. I personally haven't used it but this has a little more info aside from the git docs: http://www.foodcritic.io/#FC048 – Display Name is missing Jan 22 '14 at 19:13
-
That FC rule says to prefer shellout to standard ruby \`\` or %x. It doesn't say anything about using native resources versus shellout. They have different purposes. – sethvargo Jan 24 '14 at 15:39
1 Answers
5
Use Shellout
When you need to get the result of the command to use elsewhere
Use script
and children
When you want Chef to execute the code for you.
Shellout is not a replacement to script
/execute
blocks. They also execute at different times during the Chef Client run. Shellout is a Ruby thing, whereas script
/execute
are Chef resources like template
. There is a lot of safety and cross-platform support wrapped in these resources that you won't get with Shellout.

sethvargo
- 26,739
- 10
- 86
- 156