]> andersk Git - moira.git/blobdiff - gen/hosts.dc
had to change the get alias validate thing to use the access hook
[moira.git] / gen / hosts.dc
index a4f27a1675824f75b85c6c47a50a99d46f8595a1..9c4f4c59fedb1fd0d382184d3332734868125768 100644 (file)
@@ -113,17 +113,20 @@ char **argv;
        strtrim(model);
        strtrim(os);
        strtrim(addr);
-       if (*addr == 0)
+       if (*addr == 0 || inet_addr(addr) == -1)
          continue;
        if (p = hash_lookup(aliases, id))
          sprintf(buf, "%s,%s", name, p);
        else
          strcpy(buf, name);
        fprintf(out, "HOST : %s : %s : ", addr, buf);
-       if (*vendor && *model)
-         fprintf(out, "%s/%s : %s :\n", vendor, model, os);
-       else
-         fprintf(out, "%s%s : %s :\n", vendor, model, os);
+       if ((*vendor || *model) && *os) {
+           if (*vendor && *model)
+             fprintf(out, "%s/%s : %s :\n", vendor, model, os);
+           else
+             fprintf(out, "%s%s : %s :\n", vendor, model, os);
+       } else
+         fputs("\n", out);
     }
 
     EXEC SQL CLOSE x;
@@ -145,6 +148,10 @@ char **argv;
 
  sqlerr:
     com_err(whoami, MR_INGRES_ERR, " code %d\n", sqlca.sqlcode);
+#ifsql INGRES
+    if (sqlca.sqlcode == 17700 || sqlca.sqlcode == -37000)
+      exit(MR_DEADLOCK);
+#endsql
     critical_alert("DCM", "Hosts build encountered INGRES ERROR %d",
                   sqlca.sqlcode);
     exit(MR_INGRES_ERR);
This page took 0.036029 seconds and 4 git commands to generate.