Class: Beaker::EC2Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/beaker/hypervisor/ec2_helper.rb

Class Method Summary collapse

Class Method Details

.amiports(host) ⇒ Array<Number>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO:

horribly hard-coded

Return a list of open ports for testing based on a hosts role

Parameters:

  • host (Host)

    to find ports for

Returns:

  • (Array<Number>)

    array of port numbers



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/beaker/hypervisor/ec2_helper.rb', line 9

def self.amiports(host)
  ports = [22, 61613, 8139]

  roles = host['roles']

  if roles.include? 'database'
    ports << 5432
    ports << 8080
    ports << 8081
  end

  if roles.include? 'master'
    ports << 8140
  end

  if roles.include? 'dashboard'
    ports << 443
    ports << 4433
    ports << 4435
  end

  # If they only specified one port in the host config file, YAML will have converted it
  # into a string, but if it was more than one, an array.
  user_ports = []
  if host.has_key?('additional_ports')
    user_ports = host['additional_ports'].is_a?(Array) ? host['additional_ports'] : [host['additional_ports']]
  end

  additional_ports = ports + user_ports
  additional_ports.uniq
end