Class: Bosh::Director::Jobs::Helpers::TemplateDeleter

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

Instance Method Summary collapse

Constructor Details

#initialize(blob_deleter, logger) ⇒ TemplateDeleter

Returns a new instance of TemplateDeleter.



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

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

Instance Method Details

#delete(template, force) ⇒ Object



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

def delete(template, force)
  @logger.info("Deleting job: #{template.name}/#{template.version}")
  errors = []
  if @blob_deleter.delete(template.blobstore_id, errors, force)
    template.remove_all_release_versions
    template.destroy
  end
  errors
end