63 lines
1.7 KiB
Python
63 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Verify Hermes Agent environment is properly configured.
|
|
Checks:
|
|
1. Working directory is /root
|
|
2. Hermes profile directory exists
|
|
3. Required environment variables are set
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import json
|
|
|
|
def verify_hermes_setup():
|
|
errors = []
|
|
results = {}
|
|
|
|
# Check 1: Working directory
|
|
cwd = os.getcwd()
|
|
results['working_directory'] = cwd
|
|
if cwd != '/root':
|
|
errors.append(f"Working directory is {cwd}, expected /root")
|
|
|
|
# Check 2: Hermes profile directory
|
|
profile_dir = '/root/.hermes/profiles/spark'
|
|
exists = os.path.isdir(profile_dir)
|
|
results['profile_directory_exists'] = exists
|
|
if not exists:
|
|
errors.append(f"Profile directory {profile_dir} does not exist")
|
|
|
|
# Check 3: Required environment variables
|
|
required_vars = ['PATH', 'HOME', 'USER']
|
|
for var in required_vars:
|
|
if var in os.environ:
|
|
results[f'env_{var}'] = 'set'
|
|
else:
|
|
results[f'env_{var}'] = 'missing'
|
|
errors.append(f"Environment variable {var} is not set")
|
|
|
|
# Check 4: Python version
|
|
results['python_version'] = sys.version
|
|
|
|
# Check 5: Verify we can read the Hermes config
|
|
config_path = '/root/.hermes/profiles/spark/config.yaml'
|
|
if os.path.isfile(config_path):
|
|
results['config_file_exists'] = True
|
|
else:
|
|
results['config_file_exists'] = False
|
|
|
|
# Output results
|
|
print(json.dumps(results, indent=2))
|
|
|
|
if errors:
|
|
print("\nERRORS:", file=sys.stderr)
|
|
for e in errors:
|
|
print(f" - {e}", file=sys.stderr)
|
|
return 1
|
|
|
|
print("\nAll checks passed!", file=sys.stderr)
|
|
return 0
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(verify_hermes_setup()) |