0543266c92
- Restructuring of the project directory into client and server components - Renaming of modules and classes to better reflect their purpose and functionality - Moving common utilities and configurations to a shared location - Updating import statements to reflect the new structure - Adding new documentation files for better clarity on various aspects of the project - Removing deprecated or unused code to streamline the codebase - Ensuring that all existing functionality is preserved and that the codebase remains functional after the refactoring.
61 lines
1.6 KiB
Python
61 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Debug plugin loading.
|
|
"""
|
|
|
|
import asyncio
|
|
import logging
|
|
from pathlib import Path
|
|
|
|
# Setup path
|
|
import sys
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
|
|
from hbd.plugin import PluginRegistry, PluginLoader
|
|
|
|
logging.basicConfig(
|
|
level=logging.DEBUG,
|
|
format="%(asctime)s %(name)s %(levelname)s: %(message)s"
|
|
)
|
|
|
|
async def test_manual_load():
|
|
"""Test manual plugin loading."""
|
|
print("Testing manual plugin import...")
|
|
|
|
# Import plugins directly
|
|
from hbd.plugins.os_info import OSInfoPlugin
|
|
from hbd.plugins.cpu_monitor import CPUMonitorPlugin
|
|
|
|
# Create instances
|
|
os_plugin = OSInfoPlugin()
|
|
cpu_plugin = CPUMonitorPlugin()
|
|
|
|
print(f"OS Plugin: {os_plugin.name} v{os_plugin.version}")
|
|
print(f"CPU Plugin: {cpu_plugin.name} v{cpu_plugin.version}")
|
|
|
|
# Initialize
|
|
print("\nInitializing plugins...")
|
|
os_init = await os_plugin.initialize()
|
|
cpu_init = await cpu_plugin.initialize()
|
|
|
|
print(f"OS plugin initialized: {os_init}")
|
|
print(f"CPU plugin initialized: {cpu_init}")
|
|
|
|
# Collect data
|
|
if os_init:
|
|
print("\nCollecting OS info...")
|
|
os_data = await os_plugin.collect()
|
|
print(f"Got {len(os_data)} fields:")
|
|
for k, v in list(os_data.items())[:10]:
|
|
print(f" {k}: {v}")
|
|
|
|
if cpu_init:
|
|
print("\nCollecting CPU info...")
|
|
cpu_data = await cpu_plugin.collect()
|
|
print(f"Got {len(cpu_data)} fields:")
|
|
for k, v in cpu_data.items():
|
|
print(f" {k}: {v}")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_manual_load())
|