Class: Bosh::Director::Jobs::Helpers::PackageDeleter
- Defined in:
- lib/bosh/director/jobs/helpers/package_deleter.rb
Instance Method Summary collapse
- #delete(package, force) ⇒ Object
-
#initialize(compiled_package_deleter, blob_deleter, logger) ⇒ PackageDeleter
constructor
A new instance of PackageDeleter.
Constructor Details
#initialize(compiled_package_deleter, blob_deleter, logger) ⇒ PackageDeleter
Returns a new instance of PackageDeleter.
4 5 6 7 8 |
# File 'lib/bosh/director/jobs/helpers/package_deleter.rb', line 4 def initialize(compiled_package_deleter, blob_deleter, logger) @compiled_package_deleter = compiled_package_deleter @blob_deleter = blob_deleter @logger = logger end |
Instance Method Details
#delete(package, force) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bosh/director/jobs/helpers/package_deleter.rb', line 10 def delete(package, force) errors = [] @logger.info("Deleting package #{package.name}/#{package.version}") package.compiled_packages.each do |compiled_package| errors += @compiled_package_deleter.delete(compiled_package, {'force' => force}) end delete_successful = true if package.blobstore_id delete_successful = @blob_deleter.delete(package.blobstore_id, errors, force) end if delete_successful package.remove_all_release_versions package.destroy end errors end |