class HealthInspector::Checklists::DataBags

Public Instance Methods

load_item(name) click to toggle source
# File lib/health_inspector/checklists/data_bags.rb, line 10
def load_item(name)
  DataBag.new(@context,
              name: name,
              server: server_items.include?(name),
              local: local_items.include?(name)
  )
end
local_items() click to toggle source

JSON files are data bag items, their parent folder is the data bag

# File lib/health_inspector/checklists/data_bags.rb, line 23
def local_items
  @local_items ||= Dir["#{@context.repo_path}/data_bags/**/*.json"].map do |e|
    e.split('/')[-2].gsub('.json', '')
  end
end
server_items() click to toggle source
# File lib/health_inspector/checklists/data_bags.rb, line 18
def server_items
  @server_items ||= Chef::DataBag.list.keys
end