[GEMINI-HARDEN-01] Replace hard-coded fleet inventory with repo-native config
Some checks failed
Smoke Test / smoke (pull_request) Failing after 23s
Architecture Lint / Linter Tests (pull_request) Successful in 26s
Validate Config / YAML Lint (pull_request) Failing after 15s
Validate Config / JSON Validate (pull_request) Successful in 19s
Validate Config / Python Syntax & Import Check (pull_request) Failing after 1m1s
Validate Config / Python Test Suite (pull_request) Has been skipped
Validate Config / Shell Script Lint (pull_request) Failing after 1m4s
Validate Config / Cron Syntax Check (pull_request) Successful in 13s
Validate Config / Deploy Script Dry Run (pull_request) Successful in 13s
Validate Config / Playbook Schema Validation (pull_request) Successful in 25s
Architecture Lint / Lint Repository (pull_request) Failing after 22s
PR Checklist / pr-checklist (pull_request) Successful in 5m0s

Add fleet.inventory and fleet.path_contracts to config.yaml:
- Central source of truth for IPs, ports, roles, remote paths
- Introduce get_config_path(), load_fleet_inventory(), get_path_contract()
- Updated fleet_llama.py, self_healing.py, telemetry.py, agent_dispatch.py,
  skill_installer.py to read from config instead of hard-coded dicts/paths
- Documented inventory contract and override mechanism in scripts/README.md

Scripts retain forward-compatible fallback defaults for backwards compatibility.

Closes #433
This commit is contained in:
Alexander Payne
2026-04-26 22:47:59 -04:00
parent 34a1e68e67
commit ab9d1c0fa4
7 changed files with 267 additions and 29 deletions

View File

@@ -17,14 +17,32 @@ if SCRIPT_DIR not in sys.path:
sys.path.insert(0, SCRIPT_DIR)
from ssh_trust import VerifiedSSHExecutor
import yaml
# --- CONFIGURATION ---
FLEET = {
"mac": "10.1.10.77",
"ezra": "143.198.27.163",
"allegro": "167.99.126.228",
"bezalel": "159.203.146.185"
}
def get_config_path():
return os.environ.get('TIMMY_CONFIG') or os.path.join(
os.path.dirname(os.path.abspath(__file__)), '..', 'config.yaml'
)
def load_fleet_inventory():
"""Return {{host: ip}} map from config.yaml or fallback defaults."""
try:
with open(get_config_path(), 'r') as f:
cfg = yaml.safe_load(f)
inv = cfg.get('fleet', {}).get('inventory', {})
if inv:
return {k: v['ip'] for k, v in inv.items()}
except Exception:
pass
return {
"mac": "10.1.10.77",
"ezra": "143.198.27.163",
"allegro": "167.99.126.228",
"bezalel": "159.203.146.185",
}
FLEET = load_fleet_inventory() # dict {host: ip} loaded from config or defaults
TELEMETRY_FILE = "logs/telemetry.json"
class Telemetry: