Class: Nic::BMC

Inherits:
Managed show all
Defined in:
app/models/nic/bmc.rb

Constant Summary collapse

ATTRIBUTES =
[:username, :password, :provider]
PROVIDERS =
%w(IPMI)

Instance Method Summary collapse

Methods inherited from Managed

#dhcp_record, #queue_with_host

Methods included from Orchestration::DNS

included

Methods included from Orchestration::DHCP

included

Methods included from Orchestration

included

Methods included from Foreman::STI

included, #save_with_type

Instance Method Details

#proxyObject

Raises:


26
27
28
29
30
31
32
33
34
35
# File 'app/models/nic/bmc.rb', line 26

def proxy
  # try to find a bmc proxy in the same subnet as our bmc device
  proxy   = SmartProxy.bmc_proxies.joins(:subnets).where(['dhcp_id = ? or tftp_id = ?', subnet_id, subnet_id]).first if subnet_id
  proxy ||= SmartProxy.bmc_proxies.first
  raise Foreman::Exception.new(N_('Unable to find a proxy with BMC feature')) if proxy.nil?
  ProxyAPI::BMC.new({ :host_ip  => ip,
                      :url      => proxy.url,
                      :user     => username,
                      :password => password })
end