module Proxy::Discovery

Constants

CREATE_DISCOVERED_HOST_PATH
REFRESH_HOST_PATH
VERSION

Public Class Methods

create_discovered_host(request) click to toggle source
# File lib/smart_proxy_discovery/discovery_main.rb, line 12
def create_discovered_host(request)
  foreman_request = Proxy::HttpRequest::ForemanRequest.new()
  req = foreman_request.request_factory.create_post(CREATE_DISCOVERED_HOST_PATH, request.body.read)
  response = foreman_request.send_request(req)
  unless response.is_a? Net::HTTPSuccess
    raise response
  end
end
reboot(ip) click to toggle source
# File lib/smart_proxy_discovery/discovery_main.rb, line 27
def reboot(ip)
  url         = "http://#{ip}:8443"
  reboot_path = "/bmc/#{ip}/chassis/power/cycle"
  client      = get_rest_client(url)
  client[reboot_path].put({})
end
refresh_facts(ip) click to toggle source
# File lib/smart_proxy_discovery/discovery_main.rb, line 21
def refresh_facts(ip)
  url    = "http://#{ip}:8443"
  client = get_rest_client(url)
  client[REFRESH_HOST_PATH].get
end

Private Class Methods

get_rest_client(url) click to toggle source
# File lib/smart_proxy_discovery/discovery_main.rb, line 36
def get_rest_client(url)
  RestClient::Resource.new(url, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
end