perf: 优化发布机终端名称

pull/12066/head
Eric 2023-11-08 13:47:24 +08:00 committed by Eric_Lee
parent 621c7a31fe
commit 5e54792d94
1 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,8 @@ class DeployAppletHostManager:
download_host = download_host.rstrip("/") download_host = download_host.rstrip("/")
def handler(plays): def handler(plays):
applet_host_name = re.sub(r'[^a-zA-Z0-9]', '_', self.deployment.host.name) # 替换所有的特殊字符为下划线 _ , 防止因主机名称造成任务执行失败
applet_host_name = re.sub(r'\W', '_', self.deployment.host.name, flags=re.UNICODE)
hostname = '{}-{}'.format(applet_host_name, random_string(7)) hostname = '{}-{}'.format(applet_host_name, random_string(7))
for play in plays: for play in plays:
play["vars"].update(options) play["vars"].update(options)