clone.py 文件源码

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

项目:singularity-python 作者: singularityware 项目源码 文件源码
def package_node(root=None,name=None):
    '''package node aims to package a (present working node) for a user into
    a container. This assumes that the node is a single partition.

    :param root: the root of the node to package, default is /
    :param name: the name for the image. If not specified, will use machine's

    psutil.disk_partitions()

    '''

    if name is None:
        name = platform.node()

    if root is None:
        root = "/"

    tmpdir = tempfile.mkdtemp()
    image = "%s/%s.tgz" %(tmpdir,name)

    print("Preparing to package root %s into %s" %(root,name))
    cmd = ["tar","--one-file-system","-czvSf", image, root,"--exclude",image]
    output = run_command(cmd)
    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号