Class: Ironfan::Dsl::Realm
- Inherits:
-
Compute
- Object
- Builder
- Ironfan::Dsl
- Compute
- Ironfan::Dsl::Realm
- Defined in:
- lib/ironfan/headers.rb,
lib/ironfan/dsl/realm.rb
Instance Attribute Summary
Attributes included from Gorillib::Resolution
Class Method Summary collapse
Instance Method Summary collapse
- #children ⇒ Object
- #cluster(label, attrs = {}, &blk) ⇒ Object
-
#initialize(attrs = {}, &blk) ⇒ Realm
constructor
A new instance of Realm.
Methods inherited from Compute
_project, #cloud, cluster_role_name, #ec2, facet_role_name, #full_name, #openstack, #raid_group, #rds, #recipe, #role, #run_list, #selected_cloud, #static, #vsphere
Methods inherited from Ironfan::Dsl
#_skip_fields, #skip_fields, #to_manifest
Methods included from Gorillib::Resolution
#deep_resolve, #merge_resolve, #merge_values, #read_resolved_attribute, #read_set_attribute, #read_set_or_underlay_attribute, #read_underlay_attribute, #resolve, #resolve!, #resolve_value
Methods included from CookbookRequirements
#_cookbook_reqs, #cookbook_req, #cookbook_reqs, #join_req
Methods inherited from Builder
Constructor Details
#initialize(attrs = {}, &blk) ⇒ Realm
Returns a new instance of Realm.
18 19 20 21 22 23 |
# File 'lib/ironfan/dsl/realm.rb', line 18 def initialize(attrs = {}, &blk) cluster_names Hash.new realm_name attrs[:name] if attrs[:name] attrs[:environment] = realm_name unless attrs.has_key?(:environment) super(attrs, &blk) end |
Class Method Details
.define(attrs = {}, &blk) ⇒ Object
12 13 14 15 16 |
# File 'lib/ironfan/dsl/realm.rb', line 12 def self.define(attrs = {}, &blk) rlm = new(attrs) rlm.receive!({}, &blk) definitions[attrs[:name].to_sym] = rlm end |
.definitions ⇒ Object
8 9 10 |
# File 'lib/ironfan/dsl/realm.rb', line 8 def self.definitions @realms ||= {} end |
Instance Method Details
#children ⇒ Object
41 42 43 |
# File 'lib/ironfan/dsl/realm.rb', line 41 def children clusters.to_a end |
#cluster(label, attrs = {}, &blk) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ironfan/dsl/realm.rb', line 25 def cluster(label, attrs = {}, &blk) label = label.to_sym if clusters.keys.include? label clusters[label].tap do |cl| cl.receive! attrs cl.instance_eval(&blk) if block_given? end else cluster = Ironfan::Dsl::Cluster.define(name: label, owner: self, cluster_names: cluster_names) cluster_names[label] = label cluster.receive!(attrs, &blk) super(label, cluster) end end |