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, regions = Region::REGIONS) ⇒ LightStemcell

Returns a new instance of LightStemcell.


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

def initialize(stemcell, virtualization_type, regions=Region::REGIONS)
  @stemcell = stemcell
  @virtualization_type = virtualization_type
  @regions = regions
end

Instance Method Details

#pathObject


27
28
29
30
# File 'lib/bosh/stemcell/aws/light_stemcell.rb', line 27

def path
  stemcell_name = adjust_hvm_name(File.basename(@stemcell.path))
  File.join(File.dirname(@stemcell.path), "light-#{stemcell_name}")
end

#write_archiveObject


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

def write_archive
  @stemcell.extract(exclude: 'image') do |extracted_stemcell_dir|
    Dir.chdir(extracted_stemcell_dir) do
      FileUtils.touch('image', verbose: true)
      File.write('stemcell.MF', Psych.dump(manifest))
      Rake::FileUtilsExt.sh("sudo tar cvzf #{path} *")
    end
  end
end