class Yade::Domain::Rest::Client::HostClient

host client

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/yade/domain/rest/client/host_client.rb, line 19
def initialize
  super('yadedomain', 'host', 'Yade::Domain::Rest::Model::Host')
end

Public Instance Methods

host_by_fqdn(host_fqdn) click to toggle source

get host by fqdn

# File lib/yade/domain/rest/client/host_client.rb, line 29
def host_by_fqdn(host_fqdn)
  splitted = host_fqdn.split('.')

  hostname = splitted.first
  fqdn = splitted.last(splitted.size - 1).join('.')

  all_hosts_with_name = list.select { |h| h.name == hostname }

  domain_client = Yade::Domain::Rest::Client::DomainClient.new

  all_hosts_with_name.each do |h|
    domain = domain_client.get(h.domainId)
    return h if domain.name == fqdn
  end
end
master() click to toggle source

get master host

# File lib/yade/domain/rest/client/host_client.rb, line 24
def master
  list.select(&:isMaster).first
end