示例#1
0
def db_restore(temp_appliance_extended_db):
    app = temp_appliance_extended_db
    # get app version for backup
    ver = str(temp_appliance_extended_db.version).replace('.', '_')
    ver = ver[:3] if ver[3] == '_' else ver[:4]
    # get DB backup file
    db_storage_hostname = conf.cfme_data.bottlenecks.hostname
    db_storage_ssh = SSHClient(hostname=db_storage_hostname, **conf.credentials.bottlenecks)
    rand_filename = "/tmp/db.backup_{}".format(fauxfactory.gen_alphanumeric())
    db_storage_ssh.get_file("{}/db.backup_{}".format(
        conf.cfme_data.bottlenecks.backup_path, ver), rand_filename)
    app.ssh_client.put_file(rand_filename, "/tmp/evm_db.backup")

    app.evmserverd.stop()
    app.db.drop()
    app.db.create()
    app.db.restore()
    # When you load a database from an older version of the application, you always need to
    # run migrations.
    # https://bugzilla.redhat.com/show_bug.cgi?id=1643250
    app.db.migrate()
    app.db.fix_auth_key()
    app.db.fix_auth_dbyml()
    app.evmserverd.start()
    app.wait_for_web_ui()
def db_restore(temp_appliance_extended_db):
    app = temp_appliance_extended_db
    # get app version for backup
    ver = str(temp_appliance_extended_db.version).replace('.', '_')
    ver = ver[:3] if ver[3] == '_' else ver[:4]
    # get DB backup file
    db_storage_hostname = conf.cfme_data.bottlenecks.hostname
    db_storage_ssh = SSHClient(hostname=db_storage_hostname,
                               **conf.credentials.bottlenecks)
    rand_filename = f"/tmp/db.backup_{fauxfactory.gen_alphanumeric()}"
    db_storage_ssh.get_file(
        "{}/db.backup_{}".format(conf.cfme_data.bottlenecks.backup_path, ver),
        rand_filename)
    app.ssh_client.put_file(rand_filename, "/tmp/evm_db.backup")

    app.evmserverd.stop()
    app.db.drop()
    app.db.create()
    app.db.restore()
    # When you load a database from an older version of the application, you always need to
    # run migrations.
    # https://bugzilla.redhat.com/show_bug.cgi?id=1643250
    app.db.migrate()
    app.db.fix_auth_key()
    app.db.fix_auth_dbyml()
    app.evmserverd.start()
    app.wait_for_web_ui()
示例#3
0
def db_restore(temp_appliance_extended_db):
    app = temp_appliance_extended_db
    # get app version for backup
    ver = str(temp_appliance_extended_db.version).replace('.', '_')
    ver = ver[:3] if ver[3] == '_' else ver[:4]
    # get bd backup file
    db_storage_hostname = conf.cfme_data.bottlenecks.hostname
    db_storage_ssh = SSHClient(hostname=db_storage_hostname, **conf.credentials.bottlenecks)
    rand_filename = "/tmp/db.backup_{}".format(fauxfactory.gen_alphanumeric())
    db_storage_ssh.get_file("{}/db.backup_{}".format(
        conf.cfme_data.bottlenecks.backup_path, ver), rand_filename)
    app.ssh_client.put_file(rand_filename, "/tmp/evm_db.backup")

    app.evmserverd.stop()
    app.db.drop()
    app.db.create()
    app.db.restore()
    app.db.fix_auth_key()
    app.db.fix_auth_dbyml()
    app.start_evm_service()
    app.wait_for_web_ui()
def db_restore(temp_appliance_extended_db):
    app = temp_appliance_extended_db
    # get app version for backup
    ver = str(temp_appliance_extended_db.version).replace('.', '_')
    ver = ver[:3] if ver[3] == '_' else ver[:4]
    # get bd backup file
    db_storage_hostname = conf.cfme_data.bottlenecks.hostname
    db_storage_ssh = SSHClient(hostname=db_storage_hostname, **conf.credentials.bottlenecks)
    rand_filename = "/tmp/db.backup_{}".format(fauxfactory.gen_alphanumeric())
    db_storage_ssh.get_file("{}/db.backup_{}".format(
        conf.cfme_data.bottlenecks.backup_path, ver), rand_filename)
    app.ssh_client.put_file(rand_filename, "/tmp/evm_db.backup")

    app.evmserverd.stop()
    app.db.drop()
    app.db.create()
    app.db.restore()
    app.db.fix_auth_key()
    app.db.fix_auth_dbyml()
    app.evmserverd.start()
    app.wait_for_web_ui()
示例#5
0
def candu_db_restore(request, temp_appliance_extended_db):
    app = temp_appliance_extended_db
    # get DB backup file
    db_storage_hostname = conf.cfme_data.bottlenecks.hostname
    db_storage_ssh = SSHClient(hostname=db_storage_hostname,
                               **conf.credentials.bottlenecks)
    file_name = getattr(request, 'param', 'candu.db.backup')
    rand_filename = f"/tmp/db.backup_{fauxfactory.gen_alphanumeric()}"
    db_storage_ssh.get_file(
        f"{conf.cfme_data.bottlenecks.backup_path}/{file_name}", rand_filename)
    app.ssh_client.put_file(rand_filename, "/tmp/evm_db.backup")

    app.evmserverd.stop()
    app.db.drop()
    app.db.create()
    app.db.restore()
    # When you load a database from an older version of the application, you always need to
    # run migrations.
    # https://bugzilla.redhat.com/show_bug.cgi?id=1643250
    app.db.migrate()
    app.db.fix_auth_key()
    app.db.fix_auth_dbyml()
    app.evmserverd.start()
    app.wait_for_miq_ready()