387 extra_args=system.get('db-extra-arguments') |
387 extra_args=system.get('db-extra-arguments') |
388 extra = extra_args and {'extra_args': extra_args} or {} |
388 extra = extra_args and {'extra_args': extra_args} or {} |
389 get_connection( |
389 get_connection( |
390 system['db-driver'], database=system['db-name'], |
390 system['db-driver'], database=system['db-name'], |
391 host=system.get('db-host'), port=system.get('db-port'), |
391 host=system.get('db-host'), port=system.get('db-port'), |
392 user=system.get('db-user'), password=system.get('db-password'), |
392 user=system.get('db-user'), password=system.get('db-password'), |
393 **extra) |
393 **extra) |
394 except Exception, ex: |
394 except Exception, ex: |
395 raise ConfigurationError( |
395 raise ConfigurationError( |
396 'You seem to have provided wrong connection information in '\ |
396 'You seem to have provided wrong connection information in '\ |
397 'the %s file. Resolve this first (error: %s).' |
397 'the %s file. Resolve this first (error: %s).' |
570 'Continue anyway?' % filename): |
570 'Continue anyway?' % filename): |
571 raise ExecutionError('Error while deleting remote dump at /tmp/%s' % filename) |
571 raise ExecutionError('Error while deleting remote dump at /tmp/%s' % filename) |
572 |
572 |
573 def _local_dump(appid, output): |
573 def _local_dump(appid, output): |
574 config = ServerConfiguration.config_for(appid) |
574 config = ServerConfiguration.config_for(appid) |
575 config.repairing = True # don't check versions |
575 config.quick_start = True |
576 #config.read_instance_schema = False # bootstrap schema is enough |
576 mih = config.migration_handler(connect=False, verbosity=1) |
577 # schema=1 to avoid unnecessary fs schema loading |
|
578 mih = config.migration_handler(connect=False, schema=1, verbosity=1) |
|
579 mih.backup_database(output, askconfirm=False) |
577 mih.backup_database(output, askconfirm=False) |
580 mih.shutdown() |
578 mih.shutdown() |
581 |
579 |
582 def _local_restore(appid, backupfile, drop, systemonly=True): |
580 def _local_restore(appid, backupfile, drop, systemonly=True): |
583 config = ServerConfiguration.config_for(appid) |
581 config = ServerConfiguration.config_for(appid) |
584 config.verbosity = 1 # else we won't be asked for confirmation on problems |
582 config.verbosity = 1 # else we won't be asked for confirmation on problems |
585 config.repairing = True # don't check versions |
583 config.quick_start = True |
586 config.read_instance_schema = False # bootstrap schema is enough |
584 mih = config.migration_handler(connect=False, verbosity=1) |
587 # schema=1 to avoid unnecessary fs schema loading |
|
588 mih = config.migration_handler(connect=False, schema=1, verbosity=1) |
|
589 mih.restore_database(backupfile, drop, systemonly, askconfirm=False) |
585 mih.restore_database(backupfile, drop, systemonly, askconfirm=False) |
590 repo = mih.repo_connect() |
586 repo = mih.repo_connect() |
591 # version of the database |
587 # version of the database |
592 dbversions = repo.get_versions() |
588 dbversions = repo.get_versions() |
593 mih.shutdown() |
589 mih.shutdown() |