Check if the current distro should have skopeo with --user-agent-prefix. Returns True if we're on a distro version that ships skopeo >= 1.21.0, meaning the test must not be skipped.
()
| 65 | |
| 66 | |
| 67 | def distro_requires_user_agent_support() -> bool: |
| 68 | """Check if the current distro should have skopeo with --user-agent-prefix. |
| 69 | |
| 70 | Returns True if we're on a distro version that ships skopeo >= 1.21.0, |
| 71 | meaning the test must not be skipped. |
| 72 | """ |
| 73 | os_release = parse_os_release() |
| 74 | distro_id = os_release.get("ID", "") |
| 75 | version_id = os_release.get("VERSION_ID", "") |
| 76 | |
| 77 | try: |
| 78 | version = int(version_id) |
| 79 | except ValueError: |
| 80 | return False |
| 81 | |
| 82 | # Fedora 43+ ships skopeo 1.21.0+ |
| 83 | if distro_id == "fedora" and version >= 43: |
| 84 | return True |
| 85 | |
| 86 | return False |
| 87 | |
| 88 | |
| 89 | class RegistryHandler(http.server.BaseHTTPRequestHandler): |
no test coverage detected