Class: Bosh::Stemcell::Aws::LightStemcell

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/stemcell/aws/light_stemcell.rb

Instance Method Summary collapse

Constructor Details

#initialize(stemcell, virtualization_type) ⇒ LightStemcell

Returns a new instance of LightStemcell.



11
12
13
14
# File 'lib/bosh/stemcell/aws/light_stemcell.rb', line 11

def initialize(stemcell, virtualization_type)
  @stemcell = stemcell
  @virtualization_type = virtualization_type
end

Instance Method Details

#pathObject



30
31
32
33
34
# File 'lib/bosh/stemcell/aws/light_stemcell.rb', line 30

def path
  stemcell_name = File.basename(stemcell.path)
  stemcell_name = stemcell_name.gsub("xen", "xen-hvm") if virtualization_type == HVM_VIRTUALIZATION
  File.join(File.dirname(stemcell.path), "light-#{stemcell_name}")
end

#write_archiveObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bosh/stemcell/aws/light_stemcell.rb', line 16

def write_archive
  stemcell.extract(exclude: 'image') do |extracted_stemcell_dir|
    Dir.chdir(extracted_stemcell_dir) do
      FileUtils.touch('image', verbose: true)

      File.open('stemcell.MF', 'w') do |out|
        Psych.dump(manifest, out)
      end

      Rake::FileUtilsExt.sh("sudo tar cvzf #{path} *")
    end
  end
end