Sha256: c2340b00c7c76c6cac7cc85ef69beea3b9dcb9b69c3942111aae79a615170c36
Contents?: true
Size: 622 Bytes
Versions: 18
Compression:
Stored size: 622 Bytes
Contents
require 'chef/search/query' # simplified access to databags in the nagios cookbook class NagiosDataBags attr_accessor :bag_list def initialize(bag_list = Chef::DataBag.list) @bag_list = bag_list end # Returns an array of data bag items or an empty array # Avoids unecessary calls to search by checking against # the list of known data bags. def get(bag_name) results = [] if @bag_list.include?(bag_name) Chef::Search::Query.new.search(bag_name.to_s, '*:*') { |rows| results << rows } else Chef::Log.info "The #{bag_name} data bag does not exist." end results end end
Version data entries
18 entries across 18 versions & 1 rubygems