MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_tomcat_version

Method get_tomcat_version

class/projectModel/javaModel.py:283–323  ·  view source on GitHub ↗

@name 获取tomcat版本信息 @author lkq<2021-08-27> @param get @return string

(self, get)

Source from the content-addressed store, hash-verified

281 return public.returnMsg(False, '修改失败!')
282
283 def get_tomcat_version(self, get):
284 ''&#x27;
285 @name 获取tomcat版本信息
286 @author lkq<2021-08-27>
287 @param get<dict_obj>
288 @return string
289 ''&#x27;
290 ret = ["7", "8", "9", "10"]
291 default_path = "/usr/local/btjdk/jdk8/bin/java"
292 ret2 = {
293 'tomcat7': {'status': False, "jdk_path": default_path},
294 'tomcat8': {'status': False, "jdk_path": default_path},
295 'tomcat9': {'status': False, "jdk_path": default_path},
296 'tomcat10': {'status': False, "jdk_path": default_path},
297 }
298 rep_deemon_sh = re.compile(r"^JAVA_HOME=(?P<path>.*)\n", re.M)
299 for i in ret:
300 tmp_path = self.__bttomcat_path + '/tomcat' + i + "/bin/daemon.sh"
301 if os.path.exists(tmp_path):
302 tmp_data = public.readFile(tmp_path)
303 if isinstance(tmp_data, str):
304 re_res_jdk_path = rep_deemon_sh.search(tmp_data)
305 if re_res_jdk_path:
306 ret2["tomcat" + i]["jdk_path"] = re_res_jdk_path.group("path").strip()
307 ret2["tomcat" + i]["status"] = True
308 ret2["tomcat" + i]["path"] = self.__bttomcat_path + '/tomcat' + i
309 ret2["tomcat" + i]["start_path"] = "/etc/init.d/bttomcat" + i
310 ret2["tomcat" + i]["info"] = self.get_tomcat_info(version = i)
311 if i == '7':
312 ret2["tomcat" + i]["tomcat_server"] = self.__tomcat7_server
313 ret2["tomcat" + i]["tomcat_start"] = self.__tomcat7_path + '/bin/daemon.sh'
314 elif i == '8':
315 ret2["tomcat" + i]["tomcat_server"] = self.__tomcat8_server
316 ret2["tomcat" + i]["tomcat_start"] = self.__tomcat8_path + '/bin/daemon.sh'
317 elif i == '9':
318 ret2["tomcat" + i]["tomcat_server"] = self.__tomcat9_server
319 ret2["tomcat" + i]["tomcat_start"] = self.__tomcat9_path + '/bin/daemon.sh'
320 elif i == '10':
321 ret2["tomcat" + i]["tomcat_server"] = '/usr/local/bttomcat/tomcat10/conf/server.xml'
322 ret2["tomcat" + i]["tomcat_start"] = "/usr/local/bttomcat/tomcat10/bin/daemon.sh"
323 return ret2
324
325 def get_tomcat_info(self, version):
326 ''&#x27;

Callers 4

install_tomcatMethod · 0.95
install_tomcat_newMethod · 0.95
get_system_infoMethod · 0.95
multi_set_projectMethod · 0.95

Calls 5

get_tomcat_infoMethod · 0.95
readFileMethod · 0.80
existsMethod · 0.45
searchMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected