Class: Bosh::Director::Jobs::Backup
- Defined in:
- lib/bosh/director/jobs/backup.rb
Instance Attribute Summary collapse
-
#backup_file ⇒ Object
readonly
Returns the value of attribute backup_file.
Attributes inherited from BaseJob
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dest, options = {}) ⇒ Backup
constructor
A new instance of Backup.
- #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(dest, options = {}) ⇒ Backup
Returns a new instance of Backup.
14 15 16 17 18 |
# File 'lib/bosh/director/jobs/backup.rb', line 14 def initialize(dest, ={}) @backup_file = dest @tar_gzipper = .fetch(:tar_gzipper) { Core::TarGzipper.new } @db_adapter = .fetch(:db_adapter) { Bosh::Director::DbBackup.create(Config.db_config) } end |
Instance Attribute Details
#backup_file ⇒ Object (readonly)
Returns the value of attribute backup_file.
12 13 14 |
# File 'lib/bosh/director/jobs/backup.rb', line 12 def backup_file @backup_file end |
Class Method Details
.job_type ⇒ Object
8 9 10 |
# File 'lib/bosh/director/jobs/backup.rb', line 8 def self.job_type :bosh_backup end |
Instance Method Details
#perform ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/bosh/director/jobs/backup.rb', line 20 def perform Dir.mktmpdir do |tmp_output_dir| begin_stage('Backing up director', 4) backup_database("#{tmp_output_dir}/director_db.sql") @tar_gzipper.compress(tmp_output_dir, 'director_db.sql', @backup_file) "Backup created at #{@backup_file}" end end |