users.py 文件源码

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

项目:jenkins-charm 作者: jenkinsci 项目源码 文件源码
def configure_admin(self):
        """Configure the admin user."""
        hookenv.log("Configuring user for jenkins")

        admin = self._admin_data()
        api = Api()
        api.update_password(admin.username, admin.password)

        # Save the password to a file. It's not used directly by this charm
        # but it's convenient for integration with third-party tools.
        host.write_file(
            paths.ADMIN_PASSWORD, admin.password.encode("utf-8"),
            owner="root", group="root", perms=0o0600)

        if not os.path.exists(paths.LAST_EXEC):
            # This mean it's the very first time we configure the user,
            # and we want to create this file in order to avoid Jenkins
            # presenting the setup wizard.
            host.write_file(
                paths.LAST_EXEC, "{}\n".format(api.version()).encode("utf-8"),
                owner="jenkins", group="nogroup", perms=0o0600)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号