class Hosts

Public Class Methods

get_hosts_from_id(id) click to toggle source
# File lib/floatyhelper/hosts.rb, line 23
def self.get_hosts_from_id(id)
  data = Config.load_data
  if id == 'all'
    hosts = []
    data['vms'].each do |_tag, hostlist|
      hostlist.each do |host|
        hosts << host unless hosts.include?(host)
      end
    end
  elsif Groups.tag?(id)
    hosts = data['vms'][id]
  else
    hosts = [id].flatten
  end
  hosts
end
get_hosts_from_sut_log(file) click to toggle source
# File lib/floatyhelper/hosts.rb, line 7
def self.get_hosts_from_sut_log(file)
  hosts = []
  File.open(file).each do |line|
    items = line.split("\t")
    hostname, tag = items[4].split # rubocop:disable Lint/UselessAssignment
    short_host = hostname.split('.')[0]
    hosts << short_host
  end
  hosts
end
get_options_hosts(hosts) click to toggle source
# File lib/floatyhelper/hosts.rb, line 18
def self.get_options_hosts(hosts)
  hosts = hosts.split(',')
  hosts.map { |h| h.split('.')[0] }
end