Created
September 13, 2012 00:18
-
-
Save cprice404/3710938 to your computer and use it in GitHub Desktop.
puppetdb over ssl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host, port = args | |
puts "Hi there" | |
Puppet.notice("HI from logging!!!") | |
require 'puppet/network/http_pool' | |
path = "/metrics/mbean/java.lang:type=Memory" | |
headers = { "Accept" => "application/json" } | |
Puppet.notice("HI from logging2!!!") | |
conn = Puppet::Network::HttpPool.http_instance(host, port, true) | |
Puppet.notice("HI from logging3!!!") | |
begin | |
response = conn.get(path, headers) | |
rescue => e | |
Puppet.notice("HI from logging 3.5 (e: #{e.inspect}, #{e})") | |
end | |
Puppet.notice("HI from logging4!!!") | |
unless response.kind_of?(Net::HTTPSuccess) | |
Puppet.notice("HI from logging5!!!") | |
Puppet.err "Unable to connect to puppetdb server (#{host}:#{port}): [#{response.code}] #{response.msg}" | |
return false | |
end | |
Puppet.notice("HI from logging6!!!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment