コード例 #1
0
def list_volumes(request):
    volumes = pod_utils.list_volumes()
    volumes_out = [{
        "type": "clone",
        "name": volume.name,
        "mount_point": path,
        "size": size,
        "size_type": "",
        "snapshot": False
    } for path, volume, size in volumes]
    return volumes_out
コード例 #2
0
ファイル: command_line.py プロジェクト: Oblynx/kale
    def list_volumes(args, logger):
        """This function gets invoked by the sub-command 'list'."""
        volumes = pod_utils.list_volumes()

        if args.output == "table":
            headers = ["Mount Path", "Volume Name", "PVC Name", "Volume Size"]
            data = [(path, volume.name,
                     volume.persistent_volume_claim.claim_name, size)
                    for path, volume, size in volumes]
            logger.info(tabulate.tabulate(data, headers=headers))
        else:
            volumes_out = [{"type": "clone",
                            "name": volume.name,
                            "mount_point": path,
                            "size": size,
                            "size_type": "",
                            "snapshot": False}
                           for path, volume, size in volumes]
            print(json.dumps(volumes_out,
                             sort_keys=True,
                             indent=3,
                             separators=(",", ": ")))