Class: Ironfan::Dsl::Facet

Inherits:
Compute show all
Includes:
Plugin::Base
Defined in:
lib/ironfan/headers.rb,
lib/ironfan/dsl/facet.rb

Instance Attribute Summary

Attributes included from Gorillib::Resolution

#underlay

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Plugin::Base

#to_node

Methods inherited from Compute

_project, #cloud, cluster_role_name, #ec2, facet_role_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

ui, #ui

Constructor Details

#initialize(attrs = {}, &blk) ⇒ Facet

Returns a new instance of Facet.



16
17
18
19
20
21
22
23
24
# File 'lib/ironfan/dsl/facet.rb', line 16

def initialize(attrs = {}, &blk)
  self.cluster_names  attrs[:owner].cluster_names unless attrs[:owner].nil?
  self.realm_name     attrs[:owner].realm_name    unless attrs[:owner].nil?
  self.cluster_name = attrs[:owner].cluster_name  unless attrs[:owner].nil?
  self.name         = attrs[:name]                unless attrs[:name].nil?
  self.facet_role     Ironfan::Dsl::Role.new(name: Compute.facet_role_name(realm_name, cluster_name, name))
  super
  (0..instances - 1).each{ |idx| server idx }
end

Class Method Details

.plugin_hook(owner, attrs, plugin_name, full_name, &blk) ⇒ Object



11
12
13
14
# File 'lib/ironfan/dsl/facet.rb', line 11

def self.plugin_hook(owner, attrs, plugin_name, full_name, &blk)
  facet = owner.facet(plugin_name, new(attrs.merge(name: plugin_name, owner: owner)))
  _project(facet, &blk)
end

Instance Method Details

#childrenObject



26
27
28
# File 'lib/ironfan/dsl/facet.rb', line 26

def children
  servers.to_a + components.to_a
end

#full_cluster_nameObject



30
31
32
# File 'lib/ironfan/dsl/facet.rb', line 30

def full_cluster_name
  "#{realm_name}-#{cluster_name}"
end

#full_nameObject



34
35
36
# File 'lib/ironfan/dsl/facet.rb', line 34

def full_name
  "#{full_cluster_name}-#{name}"
end