Class: Bosh::Director::Jobs::SnapshotDeployments

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

Instance Attribute Summary

Attributes inherited from BaseJob

#task_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseJob

#begin_stage, #event_log, #logger, perform, #result_file, #single_step_stage, #task_cancelled?, #task_checkpoint, #track_and_log

Constructor Details

#initialize(options = {}) ⇒ SnapshotDeployments

Returns a new instance of SnapshotDeployments.



10
11
12
# File 'lib/bosh/director/jobs/snapshot_deployments.rb', line 10

def initialize(options={})
  @snapshot_manager = options.fetch(:snapshot_manager) { Bosh::Director::Api::SnapshotManager.new }
end

Class Method Details

.job_typeObject



6
7
8
# File 'lib/bosh/director/jobs/snapshot_deployments.rb', line 6

def self.job_type
  :snapshot_deployments
end

Instance Method Details

#performObject



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

def perform
  tasks = Models::Deployment.all.map do |deployment|
    @snapshot_manager.create_deployment_snapshot_task('scheduler', deployment)
  end

  "Enqueued snapshot tasks [#{tasks.map(&:id).join(', ')}]"
end