refractor
This commit is contained in:
parent
777d742d40
commit
334ce0aefd
9
agent.py
9
agent.py
|
@ -273,8 +273,8 @@ class ServerData:
|
|||
return os_entry['id']
|
||||
return 1
|
||||
|
||||
if 'NAME' in os_info and 'VERSION' in os_info:
|
||||
current_os = f"{os_info.get('NAME', 'Unknown')} {os_info.get('VERSION', '').strip()}".strip().lower()
|
||||
if 'ID' in os_info and 'VERSION_ID' in os_info:
|
||||
current_os = f"{os_info.get('NAME', 'Unknown')} {os_info.get('VERSION', '').strip()}".strip()
|
||||
else:
|
||||
current_os = f"{os_info.get('os_name', 'Unknown')} {os_info.get('productversion', '').strip()}".strip().lower()
|
||||
|
||||
|
@ -299,9 +299,8 @@ class ServerData:
|
|||
|
||||
|
||||
|
||||
def create_post_data(self):
|
||||
def create_post_data(self, os_list):
|
||||
ram, disk = self.get_ram_and_disk()
|
||||
os_list = self.get_os_list()
|
||||
post_data = {
|
||||
"server_type": 1,
|
||||
"os_id": self.get_os_id(os_list),
|
||||
|
@ -468,7 +467,7 @@ class ServerManager:
|
|||
return self.create_note(note_data)
|
||||
|
||||
def get_os_list(self):
|
||||
os_list = self.send_request('GET', '/api/v1/os')
|
||||
os_list = self.send_request('GET', '/api/os')
|
||||
logging.info("OS list fetched successfully") if os_list else logging.error("Failed to fetch OS list")
|
||||
return os_list or []
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user