Class: Ironfan::Provider

Inherits:
Builder show all
Defined in:
lib/ironfan/headers.rb,
lib/ironfan/headers.rb,
lib/ironfan/provider.rb,
lib/ironfan/provider/ec2.rb,
lib/ironfan/provider/rds.rb,
lib/ironfan/provider/chef.rb,
lib/ironfan/provider/static.rb,
lib/ironfan/provider/vsphere.rb,
lib/ironfan/provider/chef/node.rb,
lib/ironfan/provider/chef/role.rb,
lib/ironfan/provider/openstack.rb,
lib/ironfan/provider/virtualbox.rb,
lib/ironfan/provider/ec2/keypair.rb,
lib/ironfan/provider/rds/machine.rb,
lib/ironfan/provider/ec2/machine.rb,
lib/ironfan/provider/chef/client.rb,
lib/ironfan/provider/ec2/ebs_volume.rb,
lib/ironfan/provider/static/machine.rb,
lib/ironfan/provider/ec2/elastic_ip.rb,
lib/ironfan/provider/vsphere/keypair.rb,
lib/ironfan/provider/vsphere/machine.rb,
lib/ironfan/provider/openstack/keypair.rb,
lib/ironfan/provider/openstack/machine.rb,
lib/ironfan/provider/virtualbox/machine.rb,
lib/ironfan/provider/ec2/security_group.rb,
lib/ironfan/provider/rds/security_group.rb,
lib/ironfan/provider/ec2/placement_group.rb,
lib/ironfan/provider/openstack/elastic_ip.rb,
lib/ironfan/provider/openstack/security_group.rb,
lib/ironfan/provider/ec2/elastic_load_balancer.rb,
lib/ironfan/provider/ec2/iam_server_certificate.rb

Direct Known Subclasses

IaasProvider, ChefServer

Defined Under Namespace

Classes: ChefServer, Ec2, OpenStack, Rds, Resource, Static, VirtualBox, Vsphere

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Builder

ui, #ui

Class Method Details

.aggregate!(computers) ⇒ Object


61
62
63
64
65
# File 'lib/ironfan/provider.rb', line 61

def self.aggregate!(computers)
  resources.each do |r|
    r.aggregate!(computers) if r.shared?
  end
end

.forget!Object


45
46
47
48
49
# File 'lib/ironfan/provider.rb', line 45

def self.forget!()
  resources.each do |r|
    r.forget!
  end
end

.load(cluster) ⇒ Object

Discovery


35
36
37
38
39
40
41
42
# File 'lib/ironfan/provider.rb', line 35

def self.load(cluster)
  Ironfan.parallel (resources) do |r|
    type = r.resource_type.to_s
    Ironfan.substep(cluster.name, "loading #{type}s")
    r.load! cluster
    Ironfan.substep(cluster.name, "loaded #{type}s")
  end
end

.prepare!(computers) ⇒ Object


55
56
57
58
59
# File 'lib/ironfan/provider.rb', line 55

def self.prepare!(computers)
  resources.each do |r|
    r.prepare!(computers) if r.shared?
  end
end

.receive(obj, &block) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ironfan/provider.rb', line 9

def self.receive(obj, &block)
  if obj.is_a?(Hash)
    obj = obj.symbolize_keys
    obj[:_type] =
      case obj[:name]
      when :chef        then Chef
      when :ec2         then Ec2
      when :openstack   then OpenStack
      when :static      then Static
      when :vsphere     then Vsphere
      when :virtualbox  then VirtualBox
      when :rds         then Rds
      else raise "Unsupported provider #{obj[:name]}"
      end
  end
  super
end

.resourcesObject


28
29
30
# File 'lib/ironfan/provider.rb', line 28

def self.resources
  raise "missing #{self.class}.resources declaration"
end

.validate(computers) ⇒ Object


51
52
53
# File 'lib/ironfan/provider.rb', line 51

def self.validate(computers)
  resources.each {|r| r.validate_resources! computers }
end

Instance Method Details

#resourcesObject


27
# File 'lib/ironfan/provider.rb', line 27

def resources()     self.class.resources;   end