Class: Bosh::Director::Jobs::Helpers::ReleaseVersionDeleter

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

Instance Method Summary collapse

Constructor Details

#initialize(release_deleter, package_deleter, template_deleter, logger, event_log) ⇒ ReleaseVersionDeleter

Returns a new instance of ReleaseVersionDeleter.



5
6
7
8
9
10
11
# File 'lib/bosh/director/jobs/helpers/release_version_deleter.rb', line 5

def initialize(release_deleter, package_deleter, template_deleter, logger, event_log)
  @release_deleter = release_deleter
  @package_deleter = package_deleter
  @template_deleter = template_deleter
  @logger = logger
  @event_log = event_log
end

Instance Method Details

#delete(release_version, release, force) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bosh/director/jobs/helpers/release_version_deleter.rb', line 13

def delete(release_version, release, force)
  @logger.info('Checking for any deployments still using ' +
      'this particular release version')

  deployments = release_version.deployments

  unless deployments.empty?
    names = deployments.map { |d| d.name }.join(', ')
    raise Bosh::Director::ReleaseVersionInUse,
      "ReleaseVersion '#{release.name}/#{release_version.version}' is still in use by: #{names}"
  end

  delete_release_version(release_version, force)
end