Method: Chef::Node#data_for_save

Defined in:
lib/chef/node.rb

#data_for_saveObject

Returns hash of node data with attributes based on whitelist/blacklist rules.



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/chef/node.rb', line 713

def data_for_save
  data = for_json
  %w{automatic default normal override}.each do |level|
    allowlist = allowlist_or_whitelist_config(level)
    unless allowlist.nil? # nil => save everything
      logger.info("Allowing #{level} node attributes for save.")
      data[level] = Chef::AttributeAllowlist.filter(data[level], allowlist)
    end

    blocklist = blocklist_or_blacklist_config(level)
    unless blocklist.nil? # nil => remove nothing
      logger.info("Blocking #{level} node attributes for save")
      data[level] = Chef::AttributeBlocklist.filter(data[level], blocklist)
    end
  end
  data
end