(self, project_name, project_info)
| 5244 | return {"status": True, "data": res} |
| 5245 | |
| 5246 | def _update_project(self, project_name, project_info): |
| 5247 | # 检查是否需要更新 |
| 5248 | # 移动日志文件 |
| 5249 | # 独立项目需要修改文件 |
| 5250 | # 内置项目需要修改文件和备份文件 |
| 5251 | # 保存 |
| 5252 | if project_info['project_config']['java_type'] == 'springboot': |
| 5253 | target_file = "{}/{}.log".format(self._springboot_logs_path, str(project_name)) |
| 5254 | log_file = project_info['project_config']['logs'] |
| 5255 | if not log_file.startswith(self._springboot_logs): |
| 5256 | return |
| 5257 | if os.path.exists(log_file): |
| 5258 | self._move_logs(log_file, target_file) |
| 5259 | if not os.path.exists(target_file): |
| 5260 | return |
| 5261 | else: |
| 5262 | os.remove(log_file) |
| 5263 | |
| 5264 | project_info['project_config']["logs"] = target_file |
| 5265 | pdata = { |
| 5266 | 'name': project_name, |
| 5267 | 'project_config': json.dumps(project_info['project_config']) |
| 5268 | } |
| 5269 | public.M('sites').where('name=?', (project_name,)).update(pdata) |
| 5270 | |
| 5271 | if project_info['project_config']['java_type'] == 'duli': |
| 5272 | if "logs" in project_info['project_config']: |
| 5273 | return |
| 5274 | _path = '/www/wwwlogs/java/{}/'.format(project_name) |
| 5275 | if not os.path.exists(_path): |
| 5276 | os.makedirs(_path) |
| 5277 | target_file = '{}catalina-daemon-{}.out'.format(_path, project_info["name"].replace(".", "_")) |
| 5278 | s_file = '/www/server/bt_tomcat_web/{}/logs/catalina-daemon.out'.format(project_name) |
| 5279 | if os.path.exists(s_file): |
| 5280 | self._move_logs(s_file, target_file) |
| 5281 | if not os.path.exists(target_file): |
| 5282 | return |
| 5283 | else: |
| 5284 | os.remove(s_file) |
| 5285 | if not self._change_daemom_sh( |
| 5286 | self.__site_path + project_info["name"] + "/bin/daemon.sh", _path[:-1], |
| 5287 | project_info["name"].replace(".", "_") |
| 5288 | ): |
| 5289 | return |
| 5290 | project_info['project_config']["logs"] = _path |
| 5291 | pdata = { |
| 5292 | 'name': project_name, |
| 5293 | 'project_config': json.dumps(project_info['project_config']) |
| 5294 | } |
| 5295 | public.M('sites').where('name=?', (project_name,)).update(pdata) |
| 5296 | |
| 5297 | if project_info['project_config']['java_type'] == 'neizhi': |
| 5298 | version = project_info['project_config']['tomcat_version'] |
| 5299 | target_file = '/www/wwwlogs/java/neizhi{}/catalina-daemon-{}.out'.format(version, version) |
| 5300 | _path = '/www/wwwlogs/java/neizhi{}'.format(version) |
| 5301 | if not os.path.exists(_path): |
| 5302 | os.makedirs(_path) |
| 5303 | s_file = '/usr/local/bttomcat/tomcat%s/logs/catalina-daemon.out' % version |
no test coverage detected