Browse files

SearchChef lib added

  • Loading branch information...
1 parent ffe1964 commit 882f1f74f6525e97bc0e83d7269d68fad17574d1 @nyo16 committed Feb 3, 2012
Showing with 55 additions and 0 deletions.
  1. +55 −0 SearchChef.rb
View
55 SearchChef.rb
@@ -0,0 +1,55 @@
+require 'rubygems'
+require 'chef'
+
+class SearchChef
+
+ def initialize
+ Chef::Config.from_file('Chef knife.rb or conf file')
+ @rest = Chef::REST.new('Chef ip:4000')
+ puts "Logged in to chef......ok"
+ end
+
+ def search_node(query)
+ results = @rest.get_rest('/search/node?q='+query)
+ return results
+ end
+
+ def nodes
+ results = @rest.get_rest('/search/node')
+ return results
+ end
+
+ def search_role(query)
+ results = @rest.get_rest('/search/role?q=#{query}')
+ return results
+ end
+
+def roles
+ results = @rest.get_rest('/search/role')
+ return results
+ end
+
+
+ def search_client(query)
+ results = @rest.get_rest('/search/client?q=#{query}')
+ return results
+ end
+
+ def clients
+ results = @rest.get_rest('/search/client')
+ return results
+ end
+
+
+ def search_users(query)
+ results = @rest.get_rest('/search/users?q=#{query}')
+ return results
+ end
+
+ def users
+ results = @rest.get_rest('/search/users')
+ return results
+ end
+
+
+end

0 comments on commit 882f1f7

Please sign in to comment.