Class: Bosh::Stemcell::Aws::Ami
- Inherits:
-
Object
- Object
- Bosh::Stemcell::Aws::Ami
- Defined in:
- lib/bosh/stemcell/aws/ami.rb
Instance Attribute Summary collapse
-
#stemcell ⇒ Object
readonly
Returns the value of attribute stemcell.
Instance Method Summary collapse
-
#initialize(stemcell, region, virtualization_type) ⇒ Ami
constructor
A new instance of Ami.
- #publish ⇒ Object
Constructor Details
#initialize(stemcell, region, virtualization_type) ⇒ Ami
Returns a new instance of Ami.
12 13 14 15 16 |
# File 'lib/bosh/stemcell/aws/ami.rb', line 12 def initialize(stemcell, region, virtualization_type) @stemcell = stemcell @region = region @virtualization_type = virtualization_type || 'paravirtual' end |
Instance Attribute Details
#stemcell ⇒ Object (readonly)
Returns the value of attribute stemcell.
10 11 12 |
# File 'lib/bosh/stemcell/aws/ami.rb', line 10 def stemcell @stemcell end |
Instance Method Details
#publish ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bosh/stemcell/aws/ami.rb', line 18 def publish cloud_config = OpenStruct.new(logger: Logger.new('ami.log'), task_checkpoint: nil) Bosh::Clouds::Config.configure(cloud_config) cloud = Bosh::Clouds::Provider.create(, 'fake-director-uuid') stemcell.extract do |tmp_dir, stemcell_manifest| cloud_properties = stemcell_manifest['cloud_properties'].merge( 'virtualization_type' => virtualization_type ) ami_id = cloud.create_stemcell("#{tmp_dir}/image", cloud_properties) cloud.ec2.images[ami_id].public = true ami_id end end |