@name 获取tomcat版本信息 @author lkq<2021-08-27> @param get @return string
(self, get)
| 281 | return public.returnMsg(False, '修改失败!') |
| 282 | |
| 283 | def get_tomcat_version(self, get): |
| 284 | ''' |
| 285 | @name 获取tomcat版本信息 |
| 286 | @author lkq<2021-08-27> |
| 287 | @param get<dict_obj> |
| 288 | @return string |
| 289 | ''' |
| 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 | ''' |
no test coverage detected