usage_tracking.py 文件源码

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

项目:telepresence 作者: datawire 项目源码 文件源码
def call_scout(kubectl_version, kube_cluster_version, operation, method):
    config_root = Path.home() / ".config" / "telepresence"
    config_root.mkdir(parents=True, exist_ok=True)
    id_file = config_root / 'id'
    scout_kwargs = dict(
        kubectl_version=kubectl_version,
        kubernetes_version=kube_cluster_version,
        operation=operation,
        method=method
    )

    try:
        with id_file.open('x') as f:
            install_id = str(uuid4())
            f.write(install_id)
            scout_kwargs["new_install"] = True
    except FileExistsError:
        with id_file.open('r') as f:
            install_id = f.read()
            scout_kwargs["new_install"] = False

    scout = Scout("telepresence", __version__, install_id)

    return scout.report(**scout_kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号