Class: Bosh::Director::Jobs::ScheduledBackup
- Defined in:
- lib/bosh/director/jobs/scheduled_backup.rb
Instance Attribute Summary collapse
-
#backup_job ⇒ Object
readonly
Returns the value of attribute backup_job.
Attributes inherited from BaseJob
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ScheduledBackup
constructor
A new instance of ScheduledBackup.
- #perform ⇒ Object
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(options = {}) ⇒ ScheduledBackup
Returns a new instance of ScheduledBackup.
12 13 14 15 |
# File 'lib/bosh/director/jobs/scheduled_backup.rb', line 12 def initialize(={}) @backup_job = .fetch(:backup_job) { Backup.new(backup_file) } @backup_destination = .fetch(:backup_destination) { App.instance.blobstores.backup_destination } end |
Instance Attribute Details
#backup_job ⇒ Object (readonly)
Returns the value of attribute backup_job.
6 7 8 |
# File 'lib/bosh/director/jobs/scheduled_backup.rb', line 6 def backup_job @backup_job end |
Class Method Details
.job_type ⇒ Object
8 9 10 |
# File 'lib/bosh/director/jobs/scheduled_backup.rb', line 8 def self.job_type :scheduled_backup end |
Instance Method Details
#perform ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bosh/director/jobs/scheduled_backup.rb', line 17 def perform @backup_job.perform blobstore_path = "backup-#{Time.now.utc.iso8601}.tgz" File.open(@backup_job.backup_file) do |f| @backup_destination.create(f, blobstore_path) end "Stored '#{blobstore_path}' in backup blobstore" ensure FileUtils.rm_f(@backup_job.backup_file) end |