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) ⇒ Ami
constructor
A new instance of Ami.
- #publish ⇒ Object
Constructor Details
#initialize(stemcell, region) ⇒ Ami
Returns a new instance of Ami.
12 13 14 15 |
# File 'lib/bosh/stemcell/aws/ami.rb', line 12 def initialize(stemcell, region) @stemcell = stemcell @region = region 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
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bosh/stemcell/aws/ami.rb', line 17 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| ami_id = cloud.create_stemcell("#{tmp_dir}/image", stemcell_manifest['cloud_properties']) cloud.ec2.images[ami_id].public = true ami_id end end |