11from __future__ import annotations
22
33import configparser
4- import platform
54import os .path
5+ import platform
66import subprocess
7+ import sys
78from datetime import datetime
89
9- import requests
1010import psutil
11- import sys
12- from logicytics import Log , DEBUG , VERSION , CURRENT_FILES , Check
11+ import requests
12+
13+ from logicytics import Log , DEBUG , VERSION , Check
1314
1415if __name__ == "__main__" :
1516 log_debug = Log ({"log_level" : DEBUG , "filename" : "../ACCESS/LOGS/DEBUG/DEBUG.log" , "truncate_message" : False })
1617
1718
1819class HealthCheck :
1920 @log_debug .function
20- def get_online_config (self ) -> bool | tuple [tuple [ str , str , str ], tuple [ str , str , str ] ]:
21+ def get_online_config (self ) -> bool | tuple [str , str , str ]:
2122 """
2223 Retrieves configuration data from a remote repository and compares it with the local configuration.
2324
@@ -33,9 +34,8 @@ def get_online_config(self) -> bool | tuple[tuple[str, str, str], tuple[str, str
3334 log_debug .warning ("No connection found" )
3435 return False
3536 version_check = self .__compare_versions (VERSION , config ["System Settings" ]["version" ])
36- file_check = self .__check_files (CURRENT_FILES , config ["System Settings" ]["files" ].split (',' ))
3737
38- return version_check , file_check
38+ return version_check
3939
4040 @staticmethod
4141 def __compare_versions (
@@ -67,33 +67,6 @@ def __compare_versions(
6767 "ERROR" ,
6868 )
6969
70- @staticmethod
71- def __check_files (local_files : list , remote_files : list ) -> tuple [str , str , str ]:
72- """
73- Check if all the files in the local_files list are present in the remote_files list.
74-
75- Args:
76- local_files (list): A list of files in the local repository.
77- remote_files (list): A list of files in the remote repository.
78-
79- Returns:
80- tuple[str, str, str]: A tuple containing the result message, a message detailing the files present or missing,
81- and the log level.
82- """
83- missing_files = set (remote_files ) - set (local_files )
84- if not missing_files :
85- return (
86- "All files are present." ,
87- f"Your files: { local_files } contain all the files in the repository." ,
88- "INFO" ,
89- )
90- else :
91- return (
92- "You have missing files." ,
93- f"You are missing the following files: { missing_files } " ,
94- "ERROR" ,
95- )
96-
9770
9871class DebugCheck :
9972 @staticmethod
@@ -185,11 +158,9 @@ def debug():
185158 # Check File integrity (Online)
186159 online_config = HealthCheck ().get_online_config ()
187160 if online_config :
188- version_tuple , file_tuple = online_config
161+ version_tuple = online_config
189162 log_debug .string (version_tuple [0 ], version_tuple [2 ])
190163 log_debug .raw (f"[{ datetime .now ().strftime ('%Y-%m-%d %H:%M:%S' )} ] > DATA: | { version_tuple [1 ] + ' ' * (153 - len (version_tuple [1 ])) + '|' } " )
191- log_debug .string (file_tuple [0 ], file_tuple [2 ])
192- log_debug .raw (f"[{ datetime .now ().strftime ('%Y-%m-%d %H:%M:%S' )} ] > DATA: | { file_tuple [1 ] + ' ' * (117 - len (version_tuple [1 ])) + '|' } " )
193164
194165 # Check SysInternal Binaries
195166 message , type = DebugCheck .sys_internal_binaries ("SysInternal_Suite" )
0 commit comments