Sha256: dad446c8ec65a0936e044562c5f5712c8dbcb22ffec79f830cf1902551ee6113

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

require 'praegustator'
require 'chef/rest'
require 'chef/search/query'

module Praegustator
  module Wrappers
    class Chef
      def self.search query
        ::Chef::Config.from_file(File.expand_path(Praegustator.config['chef']['knife_location']))
        chef_query = ::Chef::Search::Query.new
        nodes = chef_query.search('node',query).first rescue []
        $stdout.puts "no node found for search criteria: #{query}" if nodes.empty?
        nodes.map{|n| Praegustator::Node.new n.name , n.ipaddress ,query}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
praegustator-0.3.0 lib/praegustator/wrappers/chef.rb