This commit is contained in:
2026-10-22 23:19:11 +02:00
parent 7d5e3b9ca2
commit 1e98cb2477
2 changed files with 8 additions and 6 deletions
Binary file not shown.
+7 -5
View File
@@ -30,7 +30,8 @@ AGENT_VERSION = "2.2"
# --- CALCOLO HASH GIT ---
def get_agent_commit():
try:
r = subprocess.run(["git", "rev-parse", "--short", "HEAD"],
# Aggiungiamo -c safe.directory=* per evitare blocchi di permessi da systemd/root
r = subprocess.run(["git", "-c", "safe.directory=*", "rev-parse", "--short", "HEAD"],
cwd=AGENT_DIR, capture_output=True, text=True, timeout=5)
if r.returncode == 0 and r.stdout.strip():
return r.stdout.strip()
@@ -39,6 +40,7 @@ def get_agent_commit():
return "unknown"
AGENT_GIT_HASH = get_agent_commit()
agent_update_available = False
# --- CALCOLO PERCORSI DINAMICI ---
AGENT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -148,13 +150,13 @@ def update_checker_loop():
global agent_update_available
while True:
try:
subprocess.run(["git", "fetch"], timeout=20, cwd=AGENT_DIR)
local = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=AGENT_DIR).decode('utf-8').strip()
remote = subprocess.check_output(["git", "rev-parse", "@{u}"], cwd=AGENT_DIR).decode('utf-8').strip()
subprocess.run(["git", "-c", "safe.directory=*", "fetch"], timeout=20, cwd=AGENT_DIR)
local = subprocess.check_output(["git", "-c", "safe.directory=*", "rev-parse", "HEAD"], cwd=AGENT_DIR).decode('utf-8').strip()
remote = subprocess.check_output(["git", "-c", "safe.directory=*", "rev-parse", "@{u}"], cwd=AGENT_DIR).decode('utf-8').strip()
agent_update_available = (local != remote)
except Exception as e:
logger.debug(f"Errore check update agent: {e}")
time.sleep(3600) # Controlla ogni ora
time.sleep(3600)
published_sig = {} # percorso file -> (mtime_ns, size) dell'ultima versione pubblicata
_warned_units = set()