class Bosh::Deployer::JobTemplate

Attributes

blobstore[R]
blobstore_id[R]
name[R]
sha1[R]
version[R]

Public Class Methods

new(template_spec, blobstore) click to toggle source
# File lib/bosh/deployer/job_template.rb, line 12
def initialize(template_spec, blobstore)
  @name = template_spec.fetch('name')
  @version = template_spec.fetch('version')
  @sha1 = template_spec.fetch('sha1')
  @blobstore_id = template_spec.fetch('blobstore_id')
  @blobstore = blobstore
end

Public Instance Methods

download_blob() click to toggle source
# File lib/bosh/deployer/job_template.rb, line 20
def download_blob
  uuid = SecureRandom.uuid
  path = File.join(Dir.tmpdir, "template-#{uuid}")
  File.open(path, 'w') do |f|
    blobstore.get(blobstore_id, f)
  end
  path
rescue Bosh::Blobstore::BlobstoreError => e
  if e.message.include?('Could not fetch object')
    raise FetchError.new
  else
    raise e
  end
end