bootstrap.py 文件源码

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

项目:landscape-client 作者: CanonicalLtd 项目源码 文件源码
def bootstrap(self, **vars):
        path = Template(self.path).substitute(**vars)
        self._create(path)

        if self.mode is not None:
            os.chmod(path, self.mode)

        if os.getuid() == 0:
            if self.username is not None:
                uid = pwd.getpwnam(self.username).pw_uid
            else:
                uid = -1

            if self.group is not None:
                gid = grp.getgrnam(self.group).gr_gid
            else:
                gid = -1

            if uid != -1 or gid != -1:
                os.chown(path, uid, gid)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号