We have a cookbook that is used on centos 6 and 7 machines. On 7 it installs the latest version of node, on 6 it installs a specific version of node. Also on 6 it installs certain other packages that we don't install on 7. I am trying to figure out how to write an InSpec tests that will only exectuce/assert that things are in a give state if we are testing a centos 6 box. How do I do this?
Running this with test kitchen.
You would use the pseudo-resource os
. This exposes a bunch of info about the underlying platform but in this case you want os[:release].start_with?('6')
(and similar for 7
).