Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SearchChef lib added

  • Loading branch information...
commit 882f1f74f6525e97bc0e83d7269d68fad17574d1 1 parent ffe1964
Nikolaos Maroulis authored
Showing with 55 additions and 0 deletions.
  1. +55 −0 SearchChef.rb
55 SearchChef.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.