Class: Slugforge::AwsTagGroup

Inherits:
HostGroup show all
Defined in:
lib/slugforge/models/host_group/aws_tag_group.rb

Instance Attribute Summary

Attributes inherited from HostGroup

#hosts, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HostGroup

detect, discover, #hosts_for_action, #install_all, #install_number_of_hosts, #install_percent_of_hosts, #sorted_hosts, #success?

Constructor Details

#initialize(pattern, compute) ⇒ AwsTagGroup

Returns a new instance of AwsTagGroup.



11
12
13
14
15
16
17
18
19
20
# File 'lib/slugforge/models/host_group/aws_tag_group.rb', line 11

def initialize(pattern, compute)
  matches = self.class.matcher.match(pattern)
  return nil unless matches
  @hosts = compute.servers.select do |server|
    server.tags[matches[1]] == matches[2] && !server.public_ip_address.nil?
  end.map do |server|
    FogHost.new(pattern, server)
  end
  super
end

Class Method Details

.matcherObject



7
8
9
# File 'lib/slugforge/models/host_group/aws_tag_group.rb', line 7

def self.matcher
  /^(\w+)=(\w+)$/
end