def _live_deploy(c, local_tarball, current_app_fullname, dump_modifier_function=None, redo_rsa=False):
    if redo_rsa:
        if RAJK_RSA:
            redo_rsa_from_text(c, RAJK_RSA)
        else:
            raise EnvironmentError('No RAJK_RSA env variable')
    local_dump_fname = '{}/deploy_dump.json'.format(TEST_DEPLOY_DIRECTORY)
    remote_dump_fname = '/var/www/rajkdjango2/deploy_dump.json'
    print('stopping server')
    stop_server(c)
    print('dumping data')
    dump(c, local_dump_fname, True)
    if (dump_modifier_function is not None):
        use_dump_modifier_function(dump_modifier_function, local_dump_fname)
    scp_command = rajk_server_connection.copy_to_server_command(local_dump_fname, remote_dump_fname)
    c.run(scp_command)
    remote_tarball = '/var/www/rajkdjango2/tarballs/{}'.format(local_tarball.split('/')[(- 1)])
    tar_scp_command = rajk_server_connection.copy_to_server_command(local_tarball, remote_tarball)
    c.run(tar_scp_command)
    install_command = '/var/www/rajkdjango2/bin/pip --no-cache-dir install --upgrade {}'.format(remote_tarball)
    remote_install_command = rajk_server_connection.run_ssh_command(install_command)
    c.run(remote_install_command)
    c.run(rajk_server_connection.run_ssh_command('rm /var/www/rajkdjango2/db.sqlite3'))
    for django_command in ['makemigrations', 'makemigrations {}'.format(current_app_fullname.split('-')[0]), 'migrate', 'loaddata {}'.format(remote_dump_fname)]:
        c.run(rajk_server_connection.remote_python_command('/var/www/rajkdjango2/manage.py {}'.format(django_command)))
    start_server(c)
def _live_deploy(c, local_tarball, current_app_fullname, dump_modifier_function=None, redo_rsa=False):
    if redo_rsa:
        if RAJK_RSA:
            redo_rsa_from_text(c, RAJK_RSA)
        else:
            raise EnvironmentError('No RAJK_RSA env variable')
    local_dump_fname = '{}/deploy_dump.json'.format(TEST_DEPLOY_DIRECTORY)
    remote_dump_fname = '/var/www/rajkdjango2/deploy_dump.json'
    print('stopping server')
    stop_server(c)
    print('dumping data')
    dump(c, local_dump_fname, True)
    if (dump_modifier_function is not None):
        use_dump_modifier_function(dump_modifier_function, local_dump_fname)
    scp_command = rajk_server_connection.copy_to_server_command(local_dump_fname, remote_dump_fname)
    c.run(scp_command)
    remote_tarball = '/var/www/rajkdjango2/tarballs/{}'.format(local_tarball.split('/')[(- 1)])
    tar_scp_command = rajk_server_connection.copy_to_server_command(local_tarball, remote_tarball)
    c.run(tar_scp_command)
    install_command = '/var/www/rajkdjango2/bin/pip --no-cache-dir install --upgrade {}'.format(remote_tarball)
    remote_install_command = rajk_server_connection.run_ssh_command(install_command)
    c.run(remote_install_command)
    c.run(rajk_server_connection.run_ssh_command('rm /var/www/rajkdjango2/db.sqlite3'))
    for django_command in ['makemigrations', 'makemigrations {}'.format(current_app_fullname.split('-')[0]), 'migrate', 'loaddata {}'.format(remote_dump_fname)]:
        c.run(rajk_server_connection.remote_python_command('/var/www/rajkdjango2/manage.py {}'.format(django_command)))
    start_server(c)