def manager_init():
    global gctx

    reg_res = register()
    if reg_res:
        dongle_id, dongle_secret = reg_res
    else:
        raise Exception("server registration failed")

    # set dongle id
    cloudlog.info("dongle id is " + dongle_id)
    os.environ['DONGLE_ID'] = dongle_id

    dirty = subprocess.call(
        ["git", "diff-index", "--quiet", "origin/release", "--"]) != 0
    cloudlog.info("dirty is %d" % dirty)
    if not dirty:
        os.environ['CLEAN'] = '1'

    cloudlog.bind_global(dongle_id=dongle_id, version=version)
    crash.bind_user(id=dongle_id)
    crash.bind_extra(version=version, dirty=dirty)

    os.umask(0)
    try:
        os.mkdir(ROOT, 0777)
    except OSError:
        pass

    # set gctx
    gctx = {}
Beispiel #2
0
def manager_init():
    global gctx

    reg_res = register()
    if reg_res:
        dongle_id, dongle_secret = reg_res
    else:
        raise Exception("server registration failed")

    # set dongle id
    cloudlog.info("dongle id is " + dongle_id)
    os.environ['DONGLE_ID'] = dongle_id

    cloudlog.bind_global(dongle_id=dongle_id, version=version)
    crash.bind_user(id=dongle_id)
    crash.bind_extra(version=version)

    os.system("mkdir -p " + ROOT)

    # set gctx
    gctx = {}