--- a/README Thu Feb 26 18:32:32 2015 +0200
+++ b/README Thu Feb 26 18:42:43 2015 +0200
@@ -42,25 +42,49 @@
fixed-address 192.0.2.2;
}
-=== Includes ===
+=== Include directories ===
Host configs can be included:
- $ cat etc/hosts/includes.test
- include = includes.test.d/
+ $ cat etc/hosts/test/test
+ include = test.d/
- [quux]
- ip = 192.0.2.3
-
- $ cat etc/hosts/includes.test.d/foo
+ $ cat etc/hosts/test/test.d/foo
ip = 192.0.2.1
- $ cat etc/hosts/includes.test.d/bar
+ $ cat etc/hosts/test/test.d/bar
ip = 192.0.2.2
- $ ./opt/bin/python bin/pvl.hosts-forward --forward-zone test etc/hosts/includes.test
- foo.includes A 192.0.2.1
- bar.includes A 192.0.2.2
- quux.includes A 192.0.2.3
+ $ bin/pvl.hosts-forward --forward-zone test etc/hosts/test/test
+ foo A 192.0.2.1
+ bar A 192.0.2.2
+
+And an entire directory of hosts-files, containing sub-domains, can be given:
+
+ $ ls etc/hosts/test/
+ asdf.test test test.d
+
+ $ cat etc/hosts/test/asdf.test
+ [quux]
+ ip = 192.0.2.5
+
+ $ bin/pvl.hosts-forward --forward-zone test etc/hosts/test/
+ foo A 192.0.2.1
+ bar A 192.0.2.2
+ quux.asdf A 192.0.2.5
+
+Note that the (include) directory name itself is NOT treated as a domain name. However, the file names which are included are.
+
+Including a directory of files is equivalent to substituiting each file as a named section at the level of the include = statement. Note that this means that included files are treated directly as host definitions, IOW, you should NOT include a section name in an included host file unless you want to declare an additional subdomain:
+
+ $ cat etc/hosts/wrong.test
+ include = wrong.d/
+
+ $ etc/hosts/wrong.d/host
+ [host]
+ ip = 192.0.2.6
+
+ $ bin/pvl.hosts-forward --forward-zone test etc/hosts/wrong.test
+ host.host.wrong A 192.0.2.6
=== Host aliases ===
Hosts can specify DNS aliases:
--- a/etc/hosts/includes.test Thu Feb 26 18:32:32 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-include = includes.test.d/
-
-[quux]
- ip = 192.0.2.3
--- a/etc/hosts/includes.test.d/bar Thu Feb 26 18:32:32 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-ip = 192.0.2.2
--- a/etc/hosts/includes.test.d/foo Thu Feb 26 18:32:32 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-ip = 192.0.2.1
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/hosts/wrong.d/host Thu Feb 26 18:42:43 2015 +0200
@@ -0,0 +1,2 @@
+[host]
+ ip = 192.0.2.6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/hosts/wrong.test Thu Feb 26 18:42:43 2015 +0200
@@ -0,0 +1,1 @@
+include = wrong.d/