[chef] validation of attributes that can't have a sensible default


Chronological Thread 
  • From: Sölvi Páll Ásgeirsson < >
  • To:
  • Subject: [chef] validation of attributes that can't have a sensible default
  • Date: Wed, 23 Oct 2013 20:39:25 +0000

Hello everyone

For some cookbook attributes, you can not set a sensible default.

What i'm doing now is setting the attribute defaults to nil and creating a _attribute_validation.rb recipe which is basically a sequence of:

unless foo[:attr] 
  Chef::Application.fatal! "foo[:attr] is unset.  Override with sane values of bar"
end

This is repetitive and boring.  Is there a smarter way of going about this which I'm missing?
Is there a way to do this directly from the attributes/*.rb ?

Thanks alot!

Sölvi Páll Á



Archive powered by MHonArc 2.6.16.

§