Class: Bosh::Director::Jobs::Helpers::CompiledPackageDeleter

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/jobs/helpers/compiled_package_deleter.rb

Instance Method Summary collapse

Constructor Details

#initialize(blob_deleter, logger) ⇒ CompiledPackageDeleter

Returns a new instance of CompiledPackageDeleter.



4
5
6
7
# File 'lib/bosh/director/jobs/helpers/compiled_package_deleter.rb', line 4

def initialize(blob_deleter, logger)
  @blob_deleter = blob_deleter
  @logger = logger
end

Instance Method Details

#delete(compiled_package, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bosh/director/jobs/helpers/compiled_package_deleter.rb', line 9

def delete(compiled_package, options = {})
  package = compiled_package.package
  @logger.info('Deleting compiled package: ' +
      "#{package.name}/#{package.version}" +
      "for #{compiled_package.stemcell_os}/#{compiled_package.stemcell_version}")

  errors = []
  if @blob_deleter.delete(compiled_package.blobstore_id, errors,  options['force'])
    compiled_package.destroy
  end
  errors
end