Enhance SSH configuration and security group management
- Added optional SSH security-group CIDR configuration in `env.example` to allow broader access if needed. - Improved `guess_operator_cidr` function to support multiple IP retrieval services and allow overriding CIDR via environment variable. - Refactored security group management to ensure idempotency and proper logging of security group rules. - Introduced helper function `_get_volume_or_none` for better volume management and error handling. - Updated `wait_ssh` function to enhance SSH connection handling with improved timeout settings and logging. - Added state reset logic in `cmd_up` to handle scenarios where the server is not found in the cloud.
This commit is contained in:
@@ -155,6 +155,16 @@ def cmd_up(
|
||||
return state
|
||||
raise CloudError(f"сервер gpu-rent в статусе {status} — разбери в панели")
|
||||
|
||||
if state.server_id:
|
||||
log(f"в state был server {state.server_id}, в облаке нет — создаём заново")
|
||||
state.server_id = None
|
||||
state.server_name = None
|
||||
state.floating_ip = None
|
||||
state.floating_ip_id = None
|
||||
state.bootstrapped = False
|
||||
state.phase = "idle"
|
||||
save_state(state)
|
||||
|
||||
flavors = list(iter_flavors(conn))
|
||||
try:
|
||||
picked = resolve_flavor(
|
||||
|
||||
Reference in New Issue
Block a user