mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-09-10 03:27:39 +02:00
Update to v8.7.0
This commit is contained in:
@@ -52,6 +52,7 @@ class main(NodeJs):
|
||||
get.bind_extranet bool 是否绑定外网 True/False 依赖于get.port 非必传
|
||||
get.domains list 域名列表 ["www.bt.cn", "bt.cn", ...] 非必传
|
||||
get.project_ps string 备注 ps 非必传
|
||||
get.deploy_type git部署
|
||||
'''
|
||||
self.set_self_get(get)
|
||||
self.set_def_name(get.def_name)
|
||||
@@ -110,6 +111,7 @@ class main(NodeJs):
|
||||
start_result = self.start_project(get)
|
||||
if not start_result["status"]:
|
||||
self.ws_err_exit(False, start_result["msg"] if "msg" in start_result else start_result["error_msg"], code=5)
|
||||
|
||||
get._ws.send(json.dumps(self.wsResult(True, "Project created successfully!", code=-1)))
|
||||
time.sleep(1)
|
||||
get._ws.close()
|
||||
@@ -363,8 +365,7 @@ cd {}
|
||||
if project_find:
|
||||
if project_find['edate'] != "0000-00-00" and project_find['edate'] < datetime.datetime.today().strftime("%Y-%m-%d"):
|
||||
return public.return_message(-1, 0, public.lang( 'The current project has expired. Please reset the project expiration date'))
|
||||
res = self.stop_project(get)
|
||||
if not res['status']: return res
|
||||
self.stop_project(get)
|
||||
res = self.start_project(get)
|
||||
if not res['status']: return res
|
||||
return public.return_message(0, 0, public.lang( 'Restarted successfully'))
|
||||
|
||||
@@ -25,7 +25,6 @@ if "/www/server/panel" not in sys.path:
|
||||
sys.path.insert(0, "/www/server/panel")
|
||||
from mod.project.nodejs import base
|
||||
|
||||
|
||||
class main(base.NodeJs):
|
||||
|
||||
def __init__(self):
|
||||
@@ -530,6 +529,31 @@ class main(base.NodeJs):
|
||||
start_result = self.start_project(get)
|
||||
if start_result["status"] != 0 :
|
||||
self.ws_err_exit(False, start_result["message"]['result'], code=5)
|
||||
import traceback
|
||||
# ================ git start ======================
|
||||
try:
|
||||
if get.get('deploy_type') in ['ssh', 'github']:
|
||||
if get.get('deploy_type') == 'ssh':
|
||||
from git_tools import GitTools
|
||||
git_obj = GitTools()
|
||||
|
||||
# 已clone项目,使用.git导入
|
||||
res = git_obj.get_git_directory(public.to_dict_obj({"site_id": project_id}))
|
||||
if res['status'] != 0:
|
||||
self.ws_err_exit(False,res['message'], code=5)
|
||||
|
||||
res = res['message']
|
||||
res = git_obj.import_existing_repository(
|
||||
public.to_dict_obj({"site_id": project_id, "repo": res['repo'],
|
||||
"branch": res['branch'], "key_path": res['key_path'], "project_type":'node'}))
|
||||
if res['status'] != 0:
|
||||
self.ws_err_exit(False, res['message'], code=5)
|
||||
except Exception as e:
|
||||
print(traceback.format_exc())
|
||||
# 失败不删除项目
|
||||
self.ws_err_exit(False, public.lang("There was an error while configuring Git tools!"), code=5)
|
||||
# ================ git end ======================
|
||||
|
||||
get._ws.send(json.dumps(self.wsResult(True, "Project created successfully!", code=-1)))
|
||||
get._ws.close()
|
||||
|
||||
@@ -542,6 +566,7 @@ class main(base.NodeJs):
|
||||
if not os.path.exists(log_path):
|
||||
os.makedirs(log_path, 493, True)
|
||||
out_file = os.path.join(str(log_path), "out.log")
|
||||
|
||||
if os.path.exists(out_file) and os.path.isfile(out_file):
|
||||
public.writeFile(out_file, "")
|
||||
err_file = os.path.join(str(log_path), "err.log")
|
||||
|
||||
Reference in New Issue
Block a user