feat(packaging): implement packaging (.tar.gz, .deb, .rpm), FHS logging, and container integration test matrix

This commit is contained in:
soda64 committed 2026-10-02 12:33:37 +02:00
1 parent 6e18bdf7b7
commit e1a99d7e6f
20 files changed
+789 -21

No files matched your search

+58 -7
View File
@@ -164,14 +164,65 @@ class HealthChecker:
)
)
else:
results.append(
CheckResult(
name=f"lock_{lock_p.name}",
status=CheckStatus.FAIL,
message=f"Lock file exists at {lock_p}",
can_remediate=False,
# No PID found in lockfile.
# In Debian/Ubuntu (/var/lib/dpkg/lock-frontend, /var/lib/dpkg/lock) and RHEL (.rpm.lock),
# lock files may exist permanently with 0 bytes and are locked via advisory flock().
# We attempt a non-blocking exclusive flock to check if another process holds it.
is_held = False
could_test_flock = False
try:
import fcntl
fd = os.open(str(lock_p), os.O_RDONLY)
try:
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
fcntl.flock(fd, fcntl.LOCK_UN)
could_test_flock = True
except (BlockingIOError, IOError, OSError):
is_held = True
could_test_flock = True
finally:
os.close(fd)
except PermissionError:
results.append(
CheckResult(
name=f"lock_{lock_p.name}",
status=CheckStatus.WARN,
message=f"Cannot inspect lock at {lock_p} (permission denied; run as root)",
can_remediate=False,
)
)
continue
except Exception:
pass
if could_test_flock:
if is_held:
results.append(
CheckResult(
name=f"lock_{lock_p.name}",
status=CheckStatus.FAIL,
message=f"Advisory lock actively held by another process at {lock_p}",
can_remediate=False,
)
)
else:
results.append(
CheckResult(
name=f"lock_{lock_p.name}",
status=CheckStatus.PASS,
message=f"No lock active at {lock_p}",
)
)
else:
results.append(
CheckResult(
name=f"lock_{lock_p.name}",
status=CheckStatus.FAIL,
message=str(lock_p),
can_remediate=True,
remediation_id="remove_stale_lock",
)
)
)
return results