Exemplo n.º 1
0
def redis_cli(cmd):
    from fabric.api import env

    opts = []
    if env.get("CFG_REDIS_PASSWORD", ""):
        opts.append("-a %s" % env.get("CFG_REDIS_PASSWORD", ""))
    if env.get("CFG_REDIS_DB", ""):
        opts.append("-n %s" % env.get("CFG_REDIS_DB", ""))
    run_local("redis-cli %s %s" % (" ".join(opts), cmd))
Exemplo n.º 2
0
def env_make_name(prefix, python, ref):
    """ Generate a MySQL friendly environment name. """
    ref = ref.split("/")
    ref = ref[-1].replace("-", "_")
    if python:
        python = run_local(("%s -c \"import sys;print str(sys.version_info[0]) + str(sys.version_info[1])\"") % python, capture=True)

    prefix = prefix.replace("_", "").replace("-", "")

    name = "%s%s%s" % (prefix, python, ref)
    if len(name) > 16:
        name = name.replace("_", "", len(name) - 16)
        return name[:16]

    return name