Class: Ironfan::Dsl::Compute
- Inherits:
-
Ironfan::Dsl
show all
- Extended by:
- Gorillib::Concern
- Defined in:
- lib/ironfan/dsl/ec2.rb,
lib/ironfan/dsl/rds.rb,
lib/ironfan/headers.rb,
lib/ironfan/deprecated.rb,
lib/ironfan/dsl/static.rb,
lib/ironfan/dsl/compute.rb,
lib/ironfan/dsl/vsphere.rb,
lib/ironfan/dsl/openstack.rb
Constant Summary
collapse
- @@run_list_rank =
0
Instance Attribute Summary
#underlay
Class Method Summary
collapse
Instance Method Summary
collapse
-
#cloud(provider = nil) ⇒ Object
-
#ec2(*attrs, &block) ⇒ Object
-
#full_name ⇒ Object
-
#initialize(attrs = {}, &block) ⇒ Compute
constructor
A new instance of Compute.
-
#openstack(*attrs, &block) ⇒ Object
-
#raid_group(rg_name, attrs = {}, &block) ⇒ Object
-
#rds(*attrs, &block) ⇒ Object
-
#recipe(recipe_name, placement = nil) ⇒ Object
-
#role(role_name, placement = nil) ⇒ Object
Add the given role/recipe to the run list.
-
#run_list ⇒ Object
-
#selected_cloud ⇒ Object
TODO: Expand the logic here to include CLI parameters, probably by injecting the CLI as a layer in the underlay structure.
-
#static(*attrs, &block) ⇒ Object
-
#vsphere(*attrs, &block) ⇒ Object
#_skip_fields, #skip_fields, #to_manifest
#deep_resolve, #merge_resolve, #merge_values, #read_resolved_attribute, #read_set_attribute, #read_set_or_underlay_attribute, #read_underlay_attribute, #resolve, #resolve!, #resolve_value
#_cookbook_reqs, #children, #cookbook_req, #cookbook_reqs, #join_req
Methods inherited from Builder
ui, #ui
Constructor Details
#initialize(attrs = {}, &block) ⇒ Compute
Returns a new instance of Compute.
46
47
48
49
|
# File 'lib/ironfan/dsl/compute.rb', line 46
def initialize(attrs={},&block)
self.underlay = attrs[:owner] if attrs[:owner]
super
end
|
Class Method Details
._project(compute, &blk) ⇒ Object
42
43
44
|
# File 'lib/ironfan/dsl/compute.rb', line 42
def self._project compute, &blk
compute.around &blk
end
|
.cluster_role_name(realm_name, cluster_name) ⇒ Object
99
100
101
|
# File 'lib/ironfan/dsl/compute.rb', line 99
def self.cluster_role_name realm_name, cluster_name
"#{realm_name}-#{cluster_name}-cluster"
end
|
.facet_role_name(realm_name, cluster_name, facet_name) ⇒ Object
103
104
105
|
# File 'lib/ironfan/dsl/compute.rb', line 103
def self.facet_role_name realm_name, cluster_name, facet_name
"#{realm_name}-#{cluster_name}-#{facet_name}-facet"
end
|
Instance Method Details
#cloud(provider = nil) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/ironfan/deprecated.rb', line 16
def cloud(provider=nil)
if provider.nil?
Ironfan.deprecated 'cloud(nil)','use cloud(:ec2) instead'
provider = :ec2
end
super(provider)
end
|
#ec2(*attrs, &block) ⇒ Object
7
|
# File 'lib/ironfan/dsl/ec2.rb', line 7
def ec2(*attrs,&block) cloud(:ec2,*attrs,&block); end
|
#full_name ⇒ Object
51
|
# File 'lib/ironfan/dsl/compute.rb', line 51
def full_name() name; end
|
#openstack(*attrs, &block) ⇒ Object
7
|
# File 'lib/ironfan/dsl/openstack.rb', line 7
def openstack(*attrs,&block) cloud(:openstack,*attrs,&block); end
|
#raid_group(rg_name, attrs = {}, &block) ⇒ Object
70
71
72
73
74
75
76
77
|
# File 'lib/ironfan/dsl/compute.rb', line 70
def raid_group(rg_name, attrs={}, &block)
raid = volumes[rg_name] || Ironfan::Dsl::RaidGroup.new(:name => rg_name)
raid.receive!(attrs, &block)
raid.sub_volumes.each do |sv_name|
volume(sv_name){ in_raid(rg_name) ; mountable(false) ; tags({}) }
end
volumes[rg_name] = raid
end
|
#rds(*attrs, &block) ⇒ Object
7
|
# File 'lib/ironfan/dsl/rds.rb', line 7
def rds(*attrs,&block) cloud(:rds,*attrs,&block); end
|
#recipe(recipe_name, placement = nil) ⇒ Object
59
60
61
|
# File 'lib/ironfan/dsl/compute.rb', line 59
def recipe(recipe_name, placement=nil)
add_to_run_list(recipe_name, placement)
end
|
#role(role_name, placement = nil) ⇒ Object
Add the given role/recipe to the run list. You can specify placement of
`:first`, `:normal` (or nil) or `:last`; the final runlist is assembled
in order by placement, and then by source position.
56
57
58
|
# File 'lib/ironfan/dsl/compute.rb', line 56
def role(role_name, placement=nil)
add_to_run_list("role[#{role_name}]", placement)
end
|
#run_list ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/ironfan/dsl/compute.rb', line 62
def run_list
mapper = run_list_items.values.map
result = mapper.each {|i| i[:name] if i[:placement]==:first }
result += mapper.each {|i| i[:name] if i[:placement]==:normal }
result += mapper.each {|i| i[:name] if i[:placement]==:last }
result.compact
end
|
#selected_cloud ⇒ Object
TODO: Expand the logic here to include CLI parameters, probably by injecting
the CLI as a layer in the underlay structure
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/ironfan/dsl/compute.rb', line 81
def selected_cloud
raise "No clouds defined, cannot select a cloud" if clouds.length == 0
unless use_cloud.nil?
return cloud(use_cloud) if clouds.include? use_cloud
raise "Requested a cloud (#{use_cloud}) that is not defined"
end
default = clouds.values.select{|c| c.default_cloud == true }
raise "More than one cloud (#{default.map{|c| c.name}.join(', ')}) marked default" if default.length > 1
return default[0] unless default.empty?
clouds.values.first
end
|
#static(*attrs, &block) ⇒ Object
7
|
# File 'lib/ironfan/dsl/static.rb', line 7
def static(*attrs,&block) cloud(:static,*attrs,&block); end
|
#vsphere(*attrs, &block) ⇒ Object
5
6
7
|
# File 'lib/ironfan/dsl/vsphere.rb', line 5
def vsphere(*attrs,&block)
cloud(:vsphere, *attrs,&block)
end
|