Class: Ironfan::Dsl::Vsphere

Inherits:
Cloud show all
Defined in:
lib/ironfan/headers.rb,
lib/ironfan/dsl/vsphere.rb

Instance Attribute Summary

Attributes included from Gorillib::Resolution

#underlay

Instance Method Summary collapse

Methods inherited from Cloud

#defaults, receive

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, #children, #cookbook_req, #cookbook_reqs, #join_req

Methods inherited from Builder

ui, #ui

Instance Method Details

#image_infoObject


37
38
39
40
41
42
43
44
# File 'lib/ironfan/dsl/vsphere.rb', line 37

def image_info
  bit_str = "#{self.bits.to_i}-bit" # correct for legacy image info.
  keys = [datacenter, bit_str, image_name]#        info = Chef::Config[:vsphere_image_info][ keys ]

  info = nil
  ui.warn("Can't find image for #{[datacenter, bit_str, image_name].inspect}") if info.blank?
  return info || {}
end

#implied_volumesObject


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/ironfan/dsl/vsphere.rb', line 46

def implied_volumes
  result = []  # FIXME : This is really making assumptions

  result << Ironfan::Dsl::Volume.new(:name => 'root') do
      device              '/dev/sda1'
      fstype              'ext4'
      keep                false
      mount_point         '/'
  end
  return result unless virtual_disks.length > 0

  virtual_disks.each_with_index do |vd, idx|
    dev, mnt = ["/dev/sd%s" %[(66 + idx).chr.downcase], idx == 0 ? "/mnt" : "/mnt#{idx}"] # WHAAAaaa 0 o ??? 
    virtualdisk = Ironfan::Dsl::Volume.new(:name => "virtualdisk#{idx}") do
      attachable          "VirtualDisk"
      fstype              vd[:fs]
      device              dev
      mount_point         vd[:mount_point] || mnt
      formattable         true
      create_at_launch    true
      mount_options       'defaults,noatime'
      tags                vd[:tags] 
    end
    result << virtualdisk
  end
  result
end

#ssh_identity_file(computer) ⇒ Object


74
75
76
77
# File 'lib/ironfan/dsl/vsphere.rb', line 74

def ssh_identity_file(computer)
  cluster = computer.server.cluster_name
  "%s/%s.pem" %[ssh_identity_dir, cluster]
end

#to_display(style, values = {}) ⇒ Object


79
80
81
82
83
84
85
86
# File 'lib/ironfan/dsl/vsphere.rb', line 79

def to_display(style,values={})
  return values if style == :minimal

  values["Datacenter"] =         datacenter
  return values if style == :default

  values
end