fetch_ceph_keys.py 文件源码

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

项目:openstack-deploy 作者: yaoice 项目源码 文件源码
def read_file(filename):
    filename_path = os.path.join('/etc/ceph', filename)

    if not os.path.exists(filename_path):
        json_exit("file not found: {}".format(filename_path), failed=True)
    if not os.access(filename_path, os.R_OK):
        json_exit("file not readable: {}".format(filename_path), failed=True)

    with open(filename_path, 'rb') as f:
        raw_data = f.read()

    return {'content': base64.b64encode(zlib.compress(raw_data)),
            'sha1': hashlib.sha1(raw_data).hexdigest(),
            'filename': filename}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号