manage.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:freeradius 作者: epiphyte 项目源码 文件源码
def build():
    """Build and apply a user configuration."""
    env = _get_vars("/etc/environment")
    env.validate(full=True)
    os.chdir(env.net_config)
    compose(env)
    new_config = os.path.join(env.net_config, FILE_NAME)
    run_config = os.path.join(env.freeradius_repo, PYTHON_MODS, FILE_NAME)
    diff = filecmp.cmp(new_config, run_config)
    if not diff:
        print('change detected')
        shutil.copyfile(run_config, run_config + ".prev")
        shutil.copyfile(new_config, run_config)
        u = pwd.getpwnam("radiusd")
        os.chown(run_config, u.pw_uid, u.pw_gid)
        update_wiki(env, run_config)
        hashed = get_file_hash(FILE_NAME)
        git = "latest commit"
        git_indicator = env.working_dir + "git"
        if os.path.exists(git_indicator):
            with open(git_indicator, 'r') as f:
                git = f.read().strip()
        status = "ready"
        _smirc("{} -> {} ({})".format(status, git, hashed))
        _feed(env, "radius configuration updated")
    daily_report(env, run_config)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号