Module: Bosh::Director::DbBackup

Defined in:
lib/bosh/director/db_backup.rb,
lib/bosh/director/db_backup/error.rb,
lib/bosh/director/db_backup/adapter/mysql2.rb,
lib/bosh/director/db_backup/adapter/sqlite.rb,
lib/bosh/director/db_backup/adapter/postgres.rb

Defined Under Namespace

Modules: Adapter

Class Method Summary collapse

Class Method Details

.adapter_to_module(adapter) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/bosh/director/db_backup.rb', line 11

def self.adapter_to_module(adapter)
  adapter_module = adapter.capitalize

  if Adapter.const_defined?(adapter_module)
    Adapter.const_get adapter_module
  else
    raise Adapter::Error.new("backup for database adapter #{adapter} (module #{adapter_module}) is not implemented")
  end
end

.create(db_config) ⇒ Object



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

def self.create(db_config)
  adapter_to_module(db_config['adapter']).new(db_config)
end