spawn/linode
Sprite da7724da68 refactor: Extract SSH key management helpers to reduce nesting
Created helper functions in shared/common.sh to simplify ensure_ssh_key():
- generate_ssh_key_if_missing(key_path): Generate SSH key if needed
- get_ssh_fingerprint(pub_path): Get MD5 fingerprint
- json_escape(string): JSON-escape strings for API bodies

Refactored ensure_ssh_key() in all cloud providers to use these helpers:
- Reduced function length from 35-52 lines to 24-28 lines
- Eliminated nested conditionals
- Made the code flow more linear and readable
- Centralized SSH key generation and fingerprint logic

Benefits:
- Single source of truth for SSH key operations
- Reduced code duplication (~40 lines per provider → 3 helper functions)
- Easier to maintain and test
- More consistent error handling

All tests pass (42/42).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 20:03:43 +00:00
..
lib refactor: Extract SSH key management helpers to reduce nesting 2026-02-07 20:03:43 +00:00
aider.sh security: Add MODEL_ID input validation to prevent injection 2026-02-07 19:52:07 +00:00
claude.sh Add Linode (Akamai) as fifth cloud provider with all 6 agents (#12) 2026-02-07 09:26:31 -08:00
codex.sh Add Linode (Akamai) as fifth cloud provider with all 6 agents (#12) 2026-02-07 09:26:31 -08:00
goose.sh Add Linode (Akamai) as fifth cloud provider with all 6 agents (#12) 2026-02-07 09:26:31 -08:00
interpreter.sh Add Open Interpreter as seventh agent across all clouds (#13) 2026-02-07 09:30:27 -08:00
nanoclaw.sh Add Linode (Akamai) as fifth cloud provider with all 6 agents (#12) 2026-02-07 09:26:31 -08:00
openclaw.sh security: Add MODEL_ID input validation to prevent injection 2026-02-07 19:52:07 +00:00