Added OS Detection Logic to Agent
This commit is contained in:
parent
3f3b333859
commit
51b7ba1cb5
@ -10,6 +10,7 @@ from functools import partial
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import base64
|
import base64
|
||||||
import traceback
|
import traceback
|
||||||
|
import platform # OS Detection
|
||||||
|
|
||||||
import socketio
|
import socketio
|
||||||
from qasync import QEventLoop
|
from qasync import QEventLoop
|
||||||
@ -77,6 +78,25 @@ class ConfigManager:
|
|||||||
CONFIG = ConfigManager(CONFIG_PATH)
|
CONFIG = ConfigManager(CONFIG_PATH)
|
||||||
CONFIG.load()
|
CONFIG.load()
|
||||||
|
|
||||||
|
# //////////////////////////////////////////////////////////////////////////
|
||||||
|
# CORE SECTION: OPERATING SYSTEM DETECTION
|
||||||
|
# //////////////////////////////////////////////////////////////////////////
|
||||||
|
def detect_agent_os():
|
||||||
|
plat = platform.system().lower()
|
||||||
|
if plat.startswith('win'):
|
||||||
|
return 'windows'
|
||||||
|
elif plat.startswith('linux'):
|
||||||
|
return 'linux'
|
||||||
|
elif plat.startswith('darwin'):
|
||||||
|
return 'macos'
|
||||||
|
else:
|
||||||
|
return 'unknown'
|
||||||
|
|
||||||
|
CONFIG.data['agent_operating_system'] = detect_agent_os()
|
||||||
|
CONFIG._write()
|
||||||
|
|
||||||
|
# //////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
def init_agent_id():
|
def init_agent_id():
|
||||||
if not CONFIG.data.get('agent_id'):
|
if not CONFIG.data.get('agent_id'):
|
||||||
CONFIG.data['agent_id'] = f"{socket.gethostname().lower()}-agent-{uuid.uuid4().hex[:8]}"
|
CONFIG.data['agent_id'] = f"{socket.gethostname().lower()}-agent-{uuid.uuid4().hex[:8]}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user