Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

SearchChef lib added

  • Loading branch information...
commit 882f1f74f6525e97bc0e83d7269d68fad17574d1 1 parent ffe1964
Nikolaos Maroulis authored

Showing 1 changed file with 55 additions and 0 deletions. Show diff stats Hide diff stats

  1. +55 0 SearchChef.rb
55 SearchChef.rb
... ... @@ -0,0 +1,55 @@
  1 +require 'rubygems'
  2 +require 'chef'
  3 +
  4 +class SearchChef
  5 +
  6 + def initialize
  7 + Chef::Config.from_file('Chef knife.rb or conf file')
  8 + @rest = Chef::REST.new('Chef ip:4000')
  9 + puts "Logged in to chef......ok"
  10 + end
  11 +
  12 + def search_node(query)
  13 + results = @rest.get_rest('/search/node?q='+query)
  14 + return results
  15 + end
  16 +
  17 + def nodes
  18 + results = @rest.get_rest('/search/node')
  19 + return results
  20 + end
  21 +
  22 + def search_role(query)
  23 + results = @rest.get_rest('/search/role?q=#{query}')
  24 + return results
  25 + end
  26 +
  27 +def roles
  28 + results = @rest.get_rest('/search/role')
  29 + return results
  30 + end
  31 +
  32 +
  33 + def search_client(query)
  34 + results = @rest.get_rest('/search/client?q=#{query}')
  35 + return results
  36 + end
  37 +
  38 + def clients
  39 + results = @rest.get_rest('/search/client')
  40 + return results
  41 + end
  42 +
  43 +
  44 + def search_users(query)
  45 + results = @rest.get_rest('/search/users?q=#{query}')
  46 + return results
  47 + end
  48 +
  49 + def users
  50 + results = @rest.get_rest('/search/users')
  51 + return results
  52 + end
  53 +
  54 +
  55 +end

0 comments on commit 882f1f7

Please sign in to comment.
Something went wrong with that request. Please try again.