Example #1
0
def _rewrite_redis_aof(veil_server=None):
    current_veil_env = get_current_veil_env()
    if not hasattr(current_veil_env.config, 'redis_servers'):
        return False
    requested = False
    for host, port in current_veil_env.config.redis_servers:
        if veil_server and veil_server.internal_ip != host:
            continue
        try:
            client = StrictRedis(host=host, port=port)
            if client.config_get('appendonly')['appendonly'] != 'yes':
                continue
            LOGGER.info('request for redis aof rewrite <%(host)s:%(port)s>', {
                'host': host,
                'port': port
            })
            client.bgrewriteaof()
            requested = True
        except Exception as e:
            if 'append only file rewriting already in progress' not in e.message:
                requested = True
                LOGGER.exception(
                    'Exception thrown while requesting for redis aof rewrite <%(host)s:%(port)s>',
                    {
                        'host': host,
                        'port': port
                    })
    return requested
Example #2
0
def upgrade_pip(setuptools_version, wheel_version, pip_version):
    env = get_current_veil_env()
    shell_execute('pip install -i {} --trusted-host {} --upgrade pip=={}'.format(env.pypi_index_url, env.pypi_index_host, pip_version), capture=True,
                  debug=True)
    shell_execute('pip install -i {} --trusted-host {} --upgrade setuptools=={}'.format(env.pypi_index_url, env.pypi_index_host, setuptools_version),
                  capture=True, debug=True)
    shell_execute('pip install -i {} --trusted-host {} --upgrade wheel=={}'.format(env.pypi_index_url, env.pypi_index_host, wheel_version), capture=True,
                  debug=True)
Example #3
0
def rewrite_redis_aof_job():
    current_veil_env = get_current_veil_env()
    if not hasattr(current_veil_env.config, 'redis_servers'):
        return
    for host, port in current_veil_env.config.redis_servers:
        client = StrictRedis(host=host, port=port)
        if client.config_get('appendonly')['appendonly'] != 'yes':
            continue
        client.bgrewriteaof()
Example #4
0
def upgrade_pip(setuptools_version, wheel_version, pip_version):
    env = get_current_veil_env()
    shell_execute(
        'pip install -i {} --trusted-host {} --upgrade pip=={}'.format(
            env.pypi_index_url, env.pypi_index_host, pip_version),
        capture=True,
        debug=True)
    shell_execute(
        'pip install -i {} --trusted-host {} --upgrade setuptools=={}'.format(
            env.pypi_index_url, env.pypi_index_host, setuptools_version),
        capture=True,
        debug=True)
    shell_execute(
        'pip install -i {} --trusted-host {} --upgrade wheel=={}'.format(
            env.pypi_index_url, env.pypi_index_host, wheel_version),
        capture=True,
        debug=True)
def upgrade_pip(version):
    env = get_current_veil_env()
    pip_index_args = '-i {}'.format(env.pypi_index_url) if env.pypi_index_url else ''
    shell_execute('pip install {} --upgrade pip=={}'.format(pip_index_args, version), capture=True, debug=True)