1.

What is blacklisting and whitelisting attributes?

Answer»

The attributes that should not be saved by the node is called Blacklisted attributes. These are defined in the client.rb file. Attributes are blacklisted BASED on attribute types. “automatic_attribute_blacklist “ defines a hash that blacklists automatic attributes. Similarly “default_attribute_blacklist”, “normal_attribute_blacklist” and “override_attribute_blacklist” are hashes that blacklist default attributes, normal attributes and override attributes respectively. The best practice is to use “automatic_attribute_blacklist “ as automatic attributes GENERATE most data after an Ohai run. For eg:

automatic_attribute_blacklist ['FILESYSTEM']

could be used to blacklist only ‘filesystem’ attributes in the below SAMPLE attribute data

{   "filesystem" => {     "/dev/disk0s2" => {       "size" => "10mb"     } } }

All other automatic attributes are saved by the node. 

The attributes that are NEEDED to be saved by a node are called Whitelist attributes.

These are also defined in the client.rb file. Similar to blacklist attributes, attributes are also whitelisted using attribute type.”automatic_attribute_whitelist”, “default_attribute_whitelist”, “normal_attribute_whitelist”, “ override_attribute_whitelist” are hashes used to whitelist automatic, default, normal and override attributes respectively. For eg:

automatic_attribute_whitelist ['network/interfaces/'] 

could be used to whitelist only network attributes among the automatic attributes generated like below:

{ "network" => {     "interfaces" => {       "eth0" => {...},       "eth1" => {...},     }   } }


Discussion

No Comment Found