检查端口是否合格 @author baozi <202-02-22> @param port ( str ): 端口号 @return [bool,msg]: 结果 + 错误信息
(port: str)
| 368 | |
| 369 | @staticmethod |
| 370 | def _check_port(port: str): |
| 371 | """检查端口是否合格 |
| 372 | @author baozi <202-02-22> |
| 373 | @param |
| 374 | port ( str ): 端口号 |
| 375 | @return [bool,msg]: 结果 + 错误信息 |
| 376 | """ |
| 377 | try: |
| 378 | if 0 < int(port) < 65535: |
| 379 | data = public.ExecShell("ss -nultp|grep ':%s '" % port)[0] |
| 380 | if data: |
| 381 | return False, "该端口已经被占用" |
| 382 | else: |
| 383 | return True, "" |
| 384 | else: |
| 385 | return False, "请输入正确的端口范围 1 < 端口 < 65535" |
| 386 | except ValueError: |
| 387 | return False, "端口请输入整数" |
| 388 | |
| 389 | @staticmethod |
| 390 | def _check_project_exist(project_name): |
no test coverage detected