Initial YakPanel commit

This commit is contained in:
Niranjan
2026-04-07 02:04:22 +05:30
commit 2826d3e7f3
5359 changed files with 1390724 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# coding: utf-8
# -------------------------------------------------------------------
# YakPanel
# -------------------------------------------------------------------
# Copyright (c) 2015-2099 YakPanel(www.yakpanel.com) All rights reserved.
# -------------------------------------------------------------------
# Author: wzz <wzz@yakpanel.com>
# -------------------------------------------------------------------
# docker模型sock 封装库 存储库
# -------------------------------------------------------------------
import json
import public
from btdockerModelV2.dockerSock.sockBase import base
class dockerVolume(base):
def __init__(self):
super(dockerVolume, self).__init__()
# 2024/3/13 上午 11:20 获取所有存储卷列表
def get_volumes(self):
'''
@name 获取所有存储卷列表
@author wzz <2024/3/13 上午 10:54>
@param "data":{"参数名":""} <数据类型> 参数描述
@return dict{"status":True/False,"msg":"提示信息"}
'''
try:
return json.loads(public.ExecShell("curl -s --unix-socket {} http:/{}/volumes"
.format(self._sock, self.get_api_version()))[0])
except Exception as e:
try:
c_list = public.ExecShell("whereis curl | awk 'print {$1}'")[0].split(" ")
for c in c_list:
if not c.endswith("/curl"): continue
res, err = public.ExecShell("{} -s --unix-socket {} http:/{}/volumes".format(c, self._sock, self.get_api_version()))
if not err: return json.loads(res)
return []
except:
return []