Information Technology Reference
In-Depth Information
Attribute Precedence
Figure 8-6 shows the three most commonly used levels of precedence that can be used in at-
tribute definitions:
Automatic
attributes are those discovered by ohai .
Default
attributes are typically set in cookbooks and attribute files.
Override
attributes are the strongest way to set an attribute—use sparingly.
Figure 8-6. Precedence levels
When setting an attribute in a cookbook, it should (almost) always be a default attribute.
There is one exception to this rule, where it makes sense to use override precedence with
environments. We'll explore the reasoning behind this in Chapter 15 .
Other than the special case of Chef environments, attribute precedence is most frequently
used when you want to customize Chef, which is beyond the scope of this topic. When you
want to implement a new feature in Chef, such as a custom resource, being able to tinker
with Chef's powerful attribute precedence engine lets you add new features to the language
that follow the general expectations for basic attribute priority outlined in this chapter. For
more information on this topic, refer to Customizing Chef , by Jon Cowie.
Search WWH ::




Custom Search