Skip to content

Commit f6d0b5c

Browse files
CopilotJackass4life
andcommitted
fix: health check now treats HTTP 403 as healthy
Nautobot 3.x returns 403 Forbidden on unauthenticated GET /api/ requests. urllib.request.urlopen() raises HTTPError on non-2xx responses, so the container was never marked healthy even though the server was running. Updated the health check to exit 0 when the server responds 401 or 403. Co-authored-by: Jackass4life <94110786+Jackass4life@users.noreply.github.com> Agent-Logs-Url: https://github.com/Jackass4life/Nautobot-maps/sessions/e33098a2-27ad-47ed-bb23-50a04349a069
1 parent c3859bb commit f6d0b5c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

development/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ services:
7373
"CMD",
7474
"python",
7575
"-c",
76-
"import urllib.request; urllib.request.urlopen('http://localhost:8080/api/')",
76+
"import urllib.request, urllib.error, sys\ntry:\n urllib.request.urlopen('http://localhost:8080/api/')\nexcept urllib.error.HTTPError as e:\n sys.exit(0 if e.code in (401, 403) else 1)\nexcept Exception:\n sys.exit(1)\n",
7777
]
7878
interval: 10s
7979
timeout: 5s

0 commit comments

Comments
 (0)