Class: Bosh::Director::Jobs::DeleteSnapshots

Inherits:
BaseJob show all
Defined in:
lib/bosh/director/jobs/delete_snapshots.rb

Instance Attribute Summary

Attributes inherited from BaseJob

#task_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseJob

#begin_stage, #dns_manager, #event_manager, #logger, perform, #result_file, schedule_message, #single_step_stage, #task_cancelled?, #task_checkpoint, #track_and_log, #username

Constructor Details

#initialize(snapshots_cids) ⇒ DeleteSnapshots

Returns a new instance of DeleteSnapshots.



11
12
13
# File 'lib/bosh/director/jobs/delete_snapshots.rb', line 11

def initialize(snapshots_cids)
  @snapshot_cids = snapshots_cids
end

Class Method Details

.job_typeObject



7
8
9
# File 'lib/bosh/director/jobs/delete_snapshots.rb', line 7

def self.job_type
  :delete_snapshot
end

Instance Method Details

#performObject



15
16
17
18
19
20
# File 'lib/bosh/director/jobs/delete_snapshots.rb', line 15

def perform
  logger.info("deleting snapshots: #{@snapshot_cids.join(', ')}")
  snapshots = Bosh::Director::Models::Snapshot.where(snapshot_cid: @snapshot_cids).to_a
  Bosh::Director::Api::SnapshotManager.delete_snapshots(snapshots)
  "snapshot(s) #{@snapshot_cids.join(', ')} deleted"
end