Class: Bosh::Director::Api::RestoreManager
- Defined in:
- lib/bosh/director/api/restore_manager.rb
Instance Method Summary collapse
-
#initialize ⇒ RestoreManager
constructor
A new instance of RestoreManager.
- #restore_db(path) ⇒ Object
Constructor Details
#initialize ⇒ RestoreManager
Returns a new instance of RestoreManager.
4 5 6 7 |
# File 'lib/bosh/director/api/restore_manager.rb', line 4 def initialize @logger = Config.logger @db_config = Config.db_config end |
Instance Method Details
#restore_db(path) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bosh/director/api/restore_manager.rb', line 9 def restore_db(path) @logger.debug("Restoring database from db_dump file: #{path}...") db_name = @db_config.fetch('database') adapter = @db_config.fetch('adapter') user = @db_config.fetch('user') pass = @db_config.fetch('password') host = @db_config.fetch('host') Process.spawn( 'sudo', "LD_LIBRARY_PATH=#{ENV['LD_LIBRARY_PATH']}", 'restore-db', adapter, host, user, pass, db_name, path, out: '/dev/null' ) end |