Skip to content

Repository files navigation

fixop — Infrastructure Fix Operations

AI Cost Tracking

PyPIVersionPythonLicenseAI CostHuman TimeModel

  • 🤖 LLM usage: $1.0518 (10 commits)
  • 👤 Human dev: ~$861 (8.6h @ $100/h, 30min dedup)

Generated on 2026-07-06 using openrouter/qwen/qwen3-coder-next


Detect and repair DNS, firewall, containers, TLS, systemd issues on local and remote servers. Zero external dependencies — uses only Python stdlib.

Install

pip install fixop

Usage as CLI

# Check remote server
fixop check --host myserver.com --user root
# Check specific categories
fixop check --host myserver.com --category dns,firewall,tls
# Auto-fix what can be fixed
fixop fix --host myserver.com --auto
# Interactive fix (confirm each)
fixop fix --host myserver.com --interactive
# Validate deploy artifacts locally
fixop validate deploy/
# Check TLS certificates
fixop check-tls app.example.com api.example.com
# Full diagnostic + fix pipeline
fixop doctor --host myserver.com --fix
# JSON output (for CI)
fixop check --host myserver.com --format json

Usage as Library

fromfixopimportHostContext, check_host_dns, check_ufw_forward_policy, fix_resolv_confctx=HostContext(host="myserver.com", user="root")
# Detect issuesissues=check_host_dns(ctx)
forissueinissues:
print(issue) # [dns] Host DNS cannot resolve acme-v02.api.letsencrypt.org# Run all checks at oncefromfixopimportcheck_allissues=check_all(ctx, domains=["app.example.com"], containers=["traefik", "web"])
# Fix issuesresult=fix_resolv_conf(ctx, nameservers=["8.8.8.8", "1.1.1.1"])
print(result) # Set /etc/resolv.conf to 8.8.8.8, 1.1.1.1# Classify runtime errorsfromfixopimportclassify_errorissue=classify_error(exit_code=137, stderr="", cmd="podman run app")
print(issue) # [container] Container killed (OOM or SIGKILL) (exit 137)# Validate deploy files locallyfromfixopimportcheck_unresolved_vars, check_placeholdersissues=check_unresolved_vars(["deploy/traefik.yml", "deploy/web.container"])
issues+=check_placeholders(["deploy/config.yml"])

Modules

ModulePurpose
ssh.pySSH transport + connectivity checks
dns.pyDNS resolution + resolv.conf + systemd-resolved
firewall.pyUFW forward policy + iptables NAT masquerade
containers.pyPodman/Docker: health, running status, disk, memory
systemd.pyUnit management, graceful restart, daemon-reload
tls.pyCertificate validation (Let's Encrypt, self-signed)
ports.pyPort conflict detection + resolution
deploy.pyDeploy artifact validation (unresolved vars, placeholders)
health.pyHTTP/TCP endpoint health checks
classify.pyRuntime error classification (exit codes, stderr patterns)
cli.pyStandalone CLI

Key Design Principles

  • Zero dependencies — stdlib only (subprocess, socket, ssl, pathlib, re, json)
  • SSH via subprocess — uses the ssh command, not paramiko (optional extra)
  • Taskfile-agnostic — operates on infrastructure primitives, not Taskfile.yml format
  • Dispatch tables — uses data-driven classification instead of if/elif chains

License

Licensed under Apache-2.0.

Author

Tom Sapletta

About

Infrastructure fix operations — detect and repair DNS, firewall, containers, TLS, systemd issues

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages