Don't generate BIND data for localhost
authorAdam Chlipala <adamc@hcoop.net>
Mon, 12 Feb 2007 03:37:57 +0000 (03:37 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Mon, 12 Feb 2007 03:37:57 +0000 (03:37 +0000)
src/domain.sml

index 4e38a98..0f1b1fc 100644 (file)
@@ -487,51 +487,55 @@ val _ = Env.containerV_one "domain"
                                             currentPath := (fn site => path (Config.tmpDir, site)))
 
                                   fun saveSoa (kind, soa : soa) node =
-                                      let
-                                          val outf = domainFile {node = node, name = "soa"}
-                                      in
-                                          TextIO.output (outf, kind);
-                                          TextIO.output (outf, "\n");
-                                          TextIO.output (outf, Int.toString ttl);
-                                          TextIO.output (outf, "\n");
-                                          TextIO.output (outf, #ns soa);
-                                          TextIO.output (outf, "\n");
-                                          case #serial soa of
-                                              NONE => ()
-                                            | SOME n => TextIO.output (outf, Int.toString n);
-                                          TextIO.output (outf, "\n");
-                                          TextIO.output (outf, Int.toString (#ref soa));
-                                          TextIO.output (outf, "\n");
-                                          TextIO.output (outf, Int.toString (#ret soa));
-                                          TextIO.output (outf, "\n");
-                                          TextIO.output (outf, Int.toString (#exp soa));
-                                          TextIO.output (outf, "\n");
-                                          TextIO.output (outf, Int.toString (#min soa));
-                                          TextIO.output (outf, "\n");
-                                          TextIO.closeOut outf
-                                      end
+                                      if dom = "localhost" then
+                                          ()
+                                      else let
+                                              val outf = domainFile {node = node, name = "soa"}
+                                          in
+                                              TextIO.output (outf, kind);
+                                              TextIO.output (outf, "\n");
+                                              TextIO.output (outf, Int.toString ttl);
+                                              TextIO.output (outf, "\n");
+                                              TextIO.output (outf, #ns soa);
+                                              TextIO.output (outf, "\n");
+                                              case #serial soa of
+                                                  NONE => ()
+                                                | SOME n => TextIO.output (outf, Int.toString n);
+                                              TextIO.output (outf, "\n");
+                                              TextIO.output (outf, Int.toString (#ref soa));
+                                              TextIO.output (outf, "\n");
+                                              TextIO.output (outf, Int.toString (#ret soa));
+                                              TextIO.output (outf, "\n");
+                                              TextIO.output (outf, Int.toString (#exp soa));
+                                              TextIO.output (outf, "\n");
+                                              TextIO.output (outf, Int.toString (#min soa));
+                                              TextIO.output (outf, "\n");
+                                              TextIO.closeOut outf
+                                          end
 
                                   fun saveNamed (kind, soa : soa, masterIp) node =
-                                      let
-                                          val outf = domainFile {node = node, name = "named.conf"}
-                                      in
-                                          TextIO.output (outf, "\nzone \"");
-                                          TextIO.output (outf, dom);
-                                          TextIO.output (outf, "\" IN {\n\ttype ");
-                                          TextIO.output (outf, kind);
-                                          TextIO.output (outf, ";\n\tfile \"");
-                                          TextIO.output (outf, Config.Bind.zonePath_real);
-                                          TextIO.output (outf, "/");
-                                          TextIO.output (outf, dom);
-                                          TextIO.output (outf, ".zone\";\n");
-                                          case kind of
-                                              "master" => TextIO.output (outf, "\tallow-update { none; };\n")
-                                            | _ => (TextIO.output (outf, "\tmasters { ");
-                                                    TextIO.output (outf, masterIp);
-                                                    TextIO.output (outf, "; };\n"));
-                                          TextIO.output (outf, "};\n");
-                                          TextIO.closeOut outf
-                                      end
+                                      if dom = "localhost" then
+                                          ()
+                                      else let
+                                              val outf = domainFile {node = node, name = "named.conf"}
+                                          in
+                                              TextIO.output (outf, "\nzone \"");
+                                              TextIO.output (outf, dom);
+                                              TextIO.output (outf, "\" IN {\n\ttype ");
+                                              TextIO.output (outf, kind);
+                                              TextIO.output (outf, ";\n\tfile \"");
+                                              TextIO.output (outf, Config.Bind.zonePath_real);
+                                              TextIO.output (outf, "/");
+                                              TextIO.output (outf, dom);
+                                              TextIO.output (outf, ".zone\";\n");
+                                              case kind of
+                                                  "master" => TextIO.output (outf, "\tallow-update { none; };\n")
+                                                | _ => (TextIO.output (outf, "\tmasters { ");
+                                                        TextIO.output (outf, masterIp);
+                                                        TextIO.output (outf, "; };\n"));
+                                              TextIO.output (outf, "};\n");
+                                              TextIO.closeOut outf
+                                          end
                               in
                                   case kind of
                                       NoDns => masterNode := NONE