Skip to content

Instantly share code, notes, and snippets.

@rottenbytes
Created October 23, 2011 18:21
Show Gist options
  • Save rottenbytes/1307671 to your computer and use it in GitHub Desktop.
Save rottenbytes/1307671 to your computer and use it in GitHub Desktop.
Integrating noah into chef
module Noah
def noah_get_host(hostname)
require "net/http"
require "json"
noah_server="http://10.251.12.10:9292"
url = URI.parse("#{noah_server}/hosts/#{hostname}")
req = Net::HTTP::Get.new(url.path)
resp = Net::HTTP.new(url.host, url.port).start do |http|
http.request(req)
end
json_data = JSON.parse(resp.body)
return json_data
end
end
class Chef::Recipe
include Noah
end
host_status=noah_get_host("fraggle")
Chef::Log.info("Noah host status : " + host_status["status"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment