[chef-dev] Re: Re: Chef DSL Helpers for Audit-Mode


Chronological Thread 
  • From: Galen Emery < >
  • To: Ryan Hass < >
  • Cc: Seth Thomas < >, " " < >
  • Subject: [chef-dev] Re: Re: Chef DSL Helpers for Audit-Mode
  • Date: Wed, 10 Jun 2015 15:07:21 -0700

Ryan,

For audit_mode, it's best to create an Analytics Server rule rather than using the handlers: https://docs.chef.io/analytics_rules.html

which will allow you to alert/notify on any failure, specific failures, etc.

On Wed, Jun 10, 2015 at 3:04 PM, Ryan Hass < " target="_blank"> > wrote:

Thank Seth for point that information out. I was able to get OS detection working with the information you provided. 


However, I think there are other parts to this conversation to discuss. For example, the ability to have a chef_handler for a failing test could allow one to notify or perform subsequent automated actions based on this event. I am not sure if that is a feature already on the roadmap for Audit mode, but I am interested in find out and providing feedback where possible.


-Ryan H.




From: Seth Thomas < " target="_blank"> >
Sent: Tuesday, June 9, 2015 6:14 PM
To: Ryan Hass
Cc: " target="_blank">
Subject: Re: [chef-dev] Chef DSL Helpers for Audit-Mode
 
Ryan,

Audit mode utilizes ServerSpec, which in turn is a "dialect" of Rspec so using Chef references like `platform` or`platform_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.

Cheers,

Seth Thomas
Chef

On Tue, Jun 9, 2015 at 3:54 PM, Ryan Hass < " title="mailto: Ctrl+Click or tap to follow the link" target="_blank"> > 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.





--
Galen Emery



Archive powered by MHonArc 2.6.16.

§