Chef DSL Helpers for Audit-Mode

I have been playing with Audit mode recently, and found myself in need of performing different assertions for different platforms. I tried using the platform? and platform_family? helpers, as well as node.platform – but in all cases it seems introspection is not available in audit mode. Is there a way to enable this, and is this something which could be added to future versions of Chef to simplify the use of Audit Mode?

-Ryan H.

Ryan,

Audit mode utilizes ServerSpec, which in turn is a “dialect” of Rspec so
using Chef references like platform orplatform_family will not work.
You should be able to use host_inventory['platform'] according to the
current ServerSpec docs though in my own ServerSpec recipes I’ve also been
able to use calls like if %w(freebsd).include?(os[:family]). I’ve not
spent a lot of time with Audit Mode myself but as it’s ServerSpec, one of
the two should work for you.

(Apologies if this is a resend, apparently I was subscribed under a
different alias so this didn’t hit the list)

Cheers,

Seth Thomas
Chef

Seth Thomas
Chef

On Tue, Jun 9, 2015 at 3:54 PM, Ryan Hass Ryan_Hass@rapid7.com wrote:

I have been playing with Audit mode recently, and found myself in need
of performing different assertions for different platforms. I tried using
the platform? and platform_family? helpers, as well as node.platform – but
in all cases it seems introspection is not available in audit mode. Is
there a way to enable this, and is this something which could be added to
future versions of Chef to simplify the use of Audit Mode?

-Ryan H.