From 18597597c78c8bf79a21f6427d74fe29f27c0484 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Tue, 2 Jan 2007 15:57:00 +0000
Subject: [PATCH] Don't complain about missing LysINV link on redirected pages;
 it is enough to complain on the base page.  Find LysINV links using the "id"
 attribute instead of searching for a link to webware, to allow for hosted
 systems.

---
 check_datorhandbok | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/check_datorhandbok b/check_datorhandbok
index 2fbfccc..90535bb 100755
--- a/check_datorhandbok
+++ b/check_datorhandbok
@@ -41,6 +41,11 @@ def check_host(hostname):
     if csub.findNext(attrs={"alt": "#REDIRECT"}):
         warning(hostname, "broken redirect")
 
+    redirected_from = tree.find(
+        "a",
+        attrs={"href":
+               "/index.php?title=%s&amp;redirect=no" % hostname.capitalize()})
+
     firstpara = csub.findNext("p").string
     if firstpara == u"(Det finns för tillfället ingen text på den här sidan.)\n":
         warning(hostname, "not documented")
@@ -48,9 +53,7 @@ def check_host(hostname):
     if not csub.findNext(attrs={"href": nagios_url(hostname)}):
         warning(hostname, "Nagios link missing")
 
-    if not csub.findNext(attrs={"href": re.compile(
-        "^https://webware.lysator.liu.se/lysinv/Thing\\?id=")}):
-
+    if redirected_from is None and not csub.findNext(attrs={"id": "LysINV"}):
         warning(hostname, "LysINV link missing")
 
     ok(hostname, "all ok")
-- 
GitLab