BIND 10 master, updated. 6ded04bbd0fb963754e4123cee99cb07de07a618 [master] Update ChangeLog for merge of #1901
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Feb 5 14:11:23 UTC 2013
The branch, master has been updated
via 6ded04bbd0fb963754e4123cee99cb07de07a618 (commit)
via bae3798603affdb276f370c1ac6b33b011a5ed4f (commit)
via 87da92a958f4eb914c981d0b3ddab3cf68d41803 (commit)
via 2dffde2cef71ec693097f59f81fe40ada8035975 (commit)
via 19a4de9fd0738a4332169f432035fd4734311f53 (commit)
via 8404133f0a362cede4819322da6506b83968e79b (commit)
via 10d63236169056c2c14cf4807d05017599c0a3bd (commit)
via f95627b501f5bf720e74de1d2cdb17219c826f02 (commit)
via 4c56f4c81c03d04a1d2b8be3250ef1bea9979ef4 (commit)
via ddfbc7fa1ca5fc712e16801f5f24807f90d8e88b (commit)
via a85aff6a94f4f8e08bf3beaaf4da6e282b28e253 (commit)
via 476b3eff5488d89b03d7ac34830ad52973e9b0bd (commit)
via 6aa1c3cc7dbb55d32304ada9b88037346ba929b0 (commit)
via bd93846c0d74b780b2e6a6547686c9bc2db6fe23 (commit)
via 0a6fc5a8a77ac5f0e579dbb57da5ea5eb1923c39 (commit)
via 95b8519b040545420529f7dee5944826f6cc1224 (commit)
via 826ac1b1e637a6aa8b5763c4b810755ac0551446 (commit)
via cfa26ab8df9b533d32b8dd5aa405bf237bb58f12 (commit)
from 3a8e933c07b9493fd5deb97d86433532c68cce8e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6ded04bbd0fb963754e4123cee99cb07de07a618
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Feb 5 15:11:11 2013 +0100
[master] Update ChangeLog for merge of #1901
commit bae3798603affdb276f370c1ac6b33b011a5ed4f
Merge: 3a8e933 87da92a
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Feb 5 14:47:05 2013 +0100
[master] Merge branch 'trac1901'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 11 +
configure.ac | 4 +-
doc/guide/bind10-guide.xml | 126 +--
src/bin/auth/b10-auth.xml | 6 +-
src/bin/auth/main.cc | 2 +-
src/bin/bind10/.gitignore | 3 +-
src/bin/bind10/Makefile.am | 32 +-
src/bin/bind10/README | 5 +-
src/bin/bind10/{bind10.xml => b10-init.xml} | 65 +-
src/bin/bind10/bind10.in | 4 +
src/bin/bind10/bind10.xml | 459 +--------
src/bin/bind10/creatorapi.txt | 28 +-
src/bin/bind10/{bind10_src.py.in => init.py.in} | 94 +-
src/bin/bind10/{bob.spec => init.spec} | 6 +-
.../{bind10_messages.mes => init_messages.mes} | 110 +-
src/bin/bind10/run_bind10.sh.in | 2 +-
src/bin/bind10/tests/args_test.py | 100 +-
src/bin/bind10/tests/bind10_test.py.in | 1076 ++++++++++----------
src/bin/bindctl/bindctl.xml | 2 +-
src/bin/bindctl/bindctl_main.py.in | 2 +-
src/bin/bindctl/command_sets.py | 24 +-
src/bin/cfgmgr/b10-cfgmgr.py.in | 2 +-
src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in | 8 +-
src/bin/cmdctl/b10-cmdctl.xml | 4 +-
src/bin/cmdctl/cmdctl.py.in | 2 +-
src/bin/ddns/b10-ddns.xml | 8 +-
src/bin/dhcp4/ctrl_dhcp4_srv.h | 2 +-
src/bin/dhcp4/tests/dhcp4_test.py | 2 +-
src/bin/dhcp6/ctrl_dhcp6_srv.h | 2 +-
src/bin/dhcp6/tests/dhcp6_test.py | 4 +-
src/bin/resolver/b10-resolver.xml | 6 +-
src/bin/stats/b10-stats-httpd.xml | 6 +-
src/bin/stats/b10-stats.xml | 10 +-
src/bin/stats/stats.py.in | 6 +-
src/bin/stats/stats.spec | 2 +-
src/bin/stats/tests/b10-stats-httpd_test.py | 10 +-
src/bin/stats/tests/b10-stats_test.py | 66 +-
src/bin/stats/tests/test_utils.py | 16 +-
src/bin/stats/tests/testdata/b10-config.db | 2 +-
src/bin/tests/process_rename_test.py.in | 2 +-
src/bin/xfrin/b10-xfrin.xml | 8 +-
src/bin/xfrout/b10-xfrout.xml | 6 +-
src/bin/zonemgr/b10-zonemgr.xml | 8 +-
src/bin/zonemgr/zonemgr.py.in | 2 +-
src/bin/zonemgr/zonemgr_messages.mes | 2 +-
src/lib/python/bind10_config.py.in | 6 +-
src/lib/python/isc/bind10/component.py | 57 +-
src/lib/python/isc/bind10/sockcreator.py | 6 +-
src/lib/python/isc/bind10/socket_cache.py | 17 +-
src/lib/python/isc/bind10/special_component.py | 52 +-
src/lib/python/isc/bind10/tests/component_test.py | 39 +-
src/lib/python/isc/config/cfgmgr.py | 80 +-
src/lib/python/isc/config/cfgmgr_messages.mes | 10 +
src/lib/python/isc/config/config_data.py | 2 +-
src/lib/python/isc/config/tests/cfgmgr_test.py | 54 +-
src/lib/python/isc/log_messages/Makefile.am | 4 +-
src/lib/python/isc/log_messages/bind10_messages.py | 1 -
src/lib/python/isc/log_messages/init_messages.py | 1 +
src/lib/server_common/portconfig.cc | 2 +-
src/lib/server_common/portconfig.h | 7 +-
src/lib/server_common/socket_request.cc | 36 +-
src/lib/server_common/tests/portconfig_unittest.cc | 4 +-
.../server_common/tests/socket_requestor_test.cc | 8 +-
.../configurations/auth/auth_badzone.config.orig | 4 +-
.../configurations/auth/auth_basic.config.orig | 4 +-
.../configurations/bindctl/bindctl.config.orig | 4 +-
.../configurations/bindctl_commands.config.orig | 4 +-
tests/lettuce/configurations/ddns/ddns.config.orig | 4 +-
.../lettuce/configurations/ddns/noddns.config.orig | 4 +-
tests/lettuce/configurations/default.config | 2 +-
.../lettuce/configurations/example.org.config.orig | 4 +-
.../configurations/example.org.inmem.config | 4 +-
tests/lettuce/configurations/example2.org.config | 4 +-
.../inmemory_over_sqlite3/secondary.conf | 4 +-
.../configurations/ixfr-out/testset1-config.db | 4 +-
.../multi_instance/multi_auth.config.orig | 4 +-
tests/lettuce/configurations/no_db_file.config | 4 +-
.../lettuce/configurations/nsec3/nsec3_auth.config | 4 +-
.../resolver/resolver_basic.config.orig | 32 +-
.../lettuce/configurations/xfrin/inmem_slave.conf | 4 +-
.../xfrin/retransfer_master.conf.orig | 4 +-
.../xfrin/retransfer_master_nons.conf.orig | 4 +-
.../xfrin/retransfer_slave.conf.orig | 4 +-
.../xfrin/retransfer_slave_notify.conf | 4 +-
tests/lettuce/data/commands/bad_command | 6 +-
tests/lettuce/features/bindctl_commands.feature | 22 +-
tests/lettuce/features/ddns_system.feature | 4 +-
tests/lettuce/features/default.feature | 2 +-
tests/lettuce/features/multi_instance.feature | 10 +-
tests/lettuce/features/terrain/bind10_control.py | 20 +-
tests/system/bindctl/tests.sh | 16 +-
tests/system/glue/nsx1/b10-config.db.in | 2 +-
tests/system/ixfr/b10-config.db.in | 2 +-
93 files changed, 1325 insertions(+), 1602 deletions(-)
copy src/bin/bind10/{bind10.xml => b10-init.xml} (88%)
create mode 100755 src/bin/bind10/bind10.in
rename src/bin/bind10/{bind10_src.py.in => init.py.in} (95%)
rename src/bin/bind10/{bob.spec => init.spec} (94%)
rename src/bin/bind10/{bind10_messages.mes => init_messages.mes} (78%)
delete mode 100644 src/lib/python/isc/log_messages/bind10_messages.py
create mode 100644 src/lib/python/isc/log_messages/init_messages.py
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 1b31278..771f4c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+565. [func]* jelte
+ The main initializer script (formerly known as either 'bind10',
+ 'boss', or 'bob'), has been renamed to b10-init (and Init in
+ configuration). Configuring which components are run is henceforth
+ done through '/Init/components', and the sbin/bind10 script is now
+ simply a shellscript that runs b10-init. Existing configuration is
+ automatically updated. NOTE: once configuration with this update
+ has been saved (by committing any new change with bindctl), you
+ cannot run older versions of BIND 10 anymore with this configuration.
+ (Trac #1901, git bae3798603affdb276f370c1ac6b33b011a5ed4f)
+
564. [func] muks
libdns++: the CNAME, DNAME, MX, NS, PTR and SRV Rdata classes now
use the generic lexer in constructors from text. This means that
diff --git a/configure.ac b/configure.ac
index 66b15d1..1fcc342 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1133,6 +1133,7 @@ AC_CONFIG_FILES([Makefile
compatcheck/Makefile
src/Makefile
src/bin/Makefile
+ src/bin/bind10/bind10
src/bin/bind10/Makefile
src/bin/bind10/tests/Makefile
src/bin/cmdctl/Makefile
@@ -1316,7 +1317,7 @@ AC_OUTPUT([doc/version.ent
src/bin/sysinfo/run_sysinfo.sh
src/bin/stats/stats.py
src/bin/stats/stats_httpd.py
- src/bin/bind10/bind10_src.py
+ src/bin/bind10/init.py
src/bin/bind10/run_bind10.sh
src/bin/bind10/tests/bind10_test.py
src/bin/bindctl/run_bindctl.sh
@@ -1382,6 +1383,7 @@ AC_OUTPUT([doc/version.ent
chmod +x src/bin/xfrin/run_b10-xfrin.sh
chmod +x src/bin/xfrout/run_b10-xfrout.sh
chmod +x src/bin/zonemgr/run_b10-zonemgr.sh
+ chmod +x src/bin/bind10/bind10
chmod +x src/bin/bind10/run_bind10.sh
chmod +x src/bin/cmdctl/tests/cmdctl_test
chmod +x src/bin/dbutil/run_dbutil.sh
diff --git a/doc/guide/bind10-guide.xml b/doc/guide/bind10-guide.xml
index 37934cd..a16bf3b 100644
--- a/doc/guide/bind10-guide.xml
+++ b/doc/guide/bind10-guide.xml
@@ -347,7 +347,7 @@ share/
share/bind10/
auth.spec
b10-cmdctl.pem
- bob.spec
+ init.spec
passwd.csv
man/
var/
@@ -432,9 +432,9 @@ var/
run): <screen>$ <userinput>bindctl</userinput></screen>
(Login with the provided default username and password.)
<screen>
-> <userinput>config add Boss/components b10-auth</userinput>
-> <userinput>config set Boss/components/b10-auth/special auth</userinput>
-> <userinput>config set Boss/components/b10-auth/kind needed</userinput>
+> <userinput>config add Init/components b10-auth</userinput>
+> <userinput>config set Init/components/b10-auth/special auth</userinput>
+> <userinput>config set Init/components/b10-auth/kind needed</userinput>
> <userinput>config commit</userinput>
> <userinput>quit</userinput>
</screen>
@@ -1274,10 +1274,10 @@ TODO
<screen><userinput><module> <command> <replaceable>[argument(s)]</replaceable></userinput></screen>
- For example, the Boss module has a 'shutdown' command to shut down
+ For example, the Init module has a 'shutdown' command to shut down
BIND 10, with an optional argument 'help':
- <screen>> <userinput>Boss shutdown help</userinput>
+ <screen>> <userinput>Init shutdown help</userinput>
Command shutdown (Shut down BIND 10)
help (Get help for command)
This command has no parameters
@@ -1300,12 +1300,12 @@ Available module names:
</screen>
When 'help' is used as a command to a module, it shows the supported commands for the module; for example:
- <screen>> <userinput>Boss help</userinput>
-Module Boss Master process
+ <screen>> <userinput>Init help</userinput>
+Module Init Master process
Available commands:
help Get help for module.
shutdown Shut down BIND 10
- ping Ping the boss process
+ ping Ping the Init process
show_processes
List the running BIND 10 processes
</screen>
@@ -1646,7 +1646,7 @@ Parameters:
to maps.
</simpara>
<simpara>
- For example, the <command>Boss/components</command>
+ For example, the <command>Init/components</command>
elements is a named set;
adding, showing, and then removing an element
can be done with the following three commands (note
@@ -1654,13 +1654,13 @@ Parameters:
'example_module'):
</simpara>
<simpara>
- <command>config add Boss/components example_module</command>
+ <command>config add Init/components example_module</command>
</simpara>
<simpara>
- <command>config show Boss/components/example_module</command>
+ <command>config show Init/components/example_module</command>
</simpara>
<simpara>
- <command>config remove Boss/components example_module</command>
+ <command>config remove Init/components example_module</command>
</simpara>
</listitem>
</varlistentry>
@@ -1708,21 +1708,21 @@ Parameters:
<screen>> <userinput>execute init_authoritative_server show</userinput>
!echo adding Authoritative server component
-config add /Boss/components b10-auth
-config set /Boss/components/b10-auth/kind needed
-config set /Boss/components/b10-auth/special auth
+config add /Init/components b10-auth
+config set /Init/components/b10-auth/kind needed
+config set /Init/components/b10-auth/special auth
!echo adding Xfrin component
-config add /Boss/components b10-xfrin
-config set /Boss/components/b10-xfrin/address Xfrin
-config set /Boss/components/b10-xfrin/kind dispensable
+config add /Init/components b10-xfrin
+config set /Init/components/b10-xfrin/address Xfrin
+config set /Init/components/b10-xfrin/kind dispensable
!echo adding Xfrout component
-config add /Boss/components b10-xfrout
-config set /Boss/components/b10-xfrout/address Xfrout
-config set /Boss/components/b10-xfrout/kind dispensable
+config add /Init/components b10-xfrout
+config set /Init/components/b10-xfrout/address Xfrout
+config set /Init/components/b10-xfrout/kind dispensable
!echo adding Zone Manager component
-config add /Boss/components b10-zonemgr
-config set /Boss/components/b10-zonemgr/address Zonemgr
-config set /Boss/components/b10-zonemgr/kind dispensable
+config add /Init/components b10-zonemgr
+config set /Init/components/b10-zonemgr/address Zonemgr
+config set /Init/components/b10-zonemgr/kind dispensable
!echo Components added. Please enter "config commit" to
!echo finalize initial setup and run the components.
</screen>
@@ -1770,7 +1770,7 @@ config set /Boss/components/b10-zonemgr/kind dispensable
<section id="bindctl_execute_notes">
<title>Notes on execute scripts</title>
Within scripts, you can add or remove modules with the normal
- configuration commands for <command>Boss/components</command>.
+ configuration commands for <command>Init/components</command>.
However, as module
configuration and commands do not show up until the module is
running, it is currently not possible to add a module and set
@@ -2091,7 +2091,7 @@ AND_MATCH := "ALL": [ RULE_RAW, RULE_RAW, ... ]
<para>
The BIND 10 suite may be shut down by stopping the
parent <command>bind10</command> process. This may be done
- by running the <userinput>Boss shutdown</userinput> command
+ by running the <userinput>Init shutdown</userinput> command
at the <command>bindctl</command> prompt.
</para>
</section>
@@ -2105,7 +2105,7 @@ AND_MATCH := "ALL": [ RULE_RAW, RULE_RAW, ... ]
of the required <command>b10-sockcreator</command>,
<command>b10-msgq</command> and <command>b10-cfgmgr</command>
components.
- The configuration is in the <varname>Boss/components</varname>
+ The configuration is in the <varname>Init/components</varname>
section. Each element represents one component, which is
an abstraction of a process.
</para>
@@ -2113,10 +2113,10 @@ AND_MATCH := "ALL": [ RULE_RAW, RULE_RAW, ... ]
<para>
To add a process to the set, let's say the resolver (which
is not started by default), you would do this:
- <screen>> <userinput>config add Boss/components b10-resolver</userinput>
-> <userinput>config set Boss/components/b10-resolver/special resolver</userinput>
-> <userinput>config set Boss/components/b10-resolver/kind needed</userinput>
-> <userinput>config set Boss/components/b10-resolver/priority 10</userinput>
+ <screen>> <userinput>config add Init/components b10-resolver</userinput>
+> <userinput>config set Init/components/b10-resolver/special resolver</userinput>
+> <userinput>config set Init/components/b10-resolver/kind needed</userinput>
+> <userinput>config set Init/components/b10-resolver/priority 10</userinput>
> <userinput>config commit</userinput></screen></para>
<para>
@@ -2146,7 +2146,7 @@ AND_MATCH := "ALL": [ RULE_RAW, RULE_RAW, ... ]
<row><entry>b10-auth</entry><entry>auth</entry><entry>Authoritative DNS server</entry></row>
<row><entry>b10-resolver</entry><entry>resolver</entry><entry>DNS resolver</entry></row>
<row><entry>b10-cmdctl</entry><entry>cmdctl</entry><entry>Command control (remote control interface)</entry></row>
- <!-- TODO Either add xfrin and xfrout as well or clean up the workarounds in boss before the release -->
+ <!-- TODO Either add xfrin and xfrout as well or clean up the workarounds in b10-init before the release -->
</tbody>
</tgroup>
</table>
@@ -2230,9 +2230,9 @@ address, but the usual ones don't." mean? -->
You might want to do that to gain more performance (each one uses only
single core). Just put multiple entries under different names, like
this, with the same config:
- <screen>> <userinput>config add Boss/components b10-resolver-2</userinput>
-> <userinput>config set Boss/components/b10-resolver-2/special resolver</userinput>
-> <userinput>config set Boss/components/b10-resolver-2/kind needed</userinput>
+ <screen>> <userinput>config add Init/components b10-resolver-2</userinput>
+> <userinput>config set Init/components/b10-resolver-2/special resolver</userinput>
+> <userinput>config set Init/components/b10-resolver-2/kind needed</userinput>
> <userinput>config commit</userinput></screen>
</para>
<para>
@@ -2248,7 +2248,7 @@ address, but the usual ones don't." mean? -->
<para>
The running processes started by <command>bind10</command>
- may be listed by running <userinput>Boss show_processes</userinput>
+ may be listed by running <userinput>Init show_processes</userinput>
using <command>bindctl</command>.
</para>
@@ -2420,7 +2420,7 @@ can use various data source backends.
<simpara>Stop the authoritative DNS server.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the BIND 10 init process may restart this service
if configured.)
</simpara>
</listitem>
@@ -3024,9 +3024,9 @@ what is XfroutClient xfr_client??
It can be done by using the <command>bindctl</command>
utility. For example:
<screen>
-> <userinput>config add Boss/components b10-ddns</userinput>
-> <userinput>config set Boss/components/b10-ddns/address DDNS</userinput>
-> <userinput>config set Boss/components/b10-ddns/kind dispensable</userinput>
+> <userinput>config add Init/components b10-ddns</userinput>
+> <userinput>config set Init/components/b10-ddns/address DDNS</userinput>
+> <userinput>config set Init/components/b10-ddns/kind dispensable</userinput>
> <userinput>config commit</userinput>
</screen>
<note><simpara>
@@ -3217,10 +3217,10 @@ what is XfroutClient xfr_client??
<command>bindctl</command>, for example:
<screen>
-> <userinput>config add Boss/components b10-resolver</userinput>
-> <userinput>config set Boss/components/b10-resolver/special resolver</userinput>
-> <userinput>config set Boss/components/b10-resolver/kind needed</userinput>
-> <userinput>config set Boss/components/b10-resolver/priority 10</userinput>
+> <userinput>config add Init/components b10-resolver</userinput>
+> <userinput>config set Init/components/b10-resolver/special resolver</userinput>
+> <userinput>config set Init/components/b10-resolver/kind needed</userinput>
+> <userinput>config set Init/components/b10-resolver/priority 10</userinput>
> <userinput>config commit</userinput>
</screen>
@@ -3340,7 +3340,7 @@ then change those defaults with config set Resolver/forward_addresses[0]/address
both servers. DHCPv4-specific details are covered in <xref linkend="dhcp4"/>,
while those details specific to DHCPv6 are described in <xref linkend="dhcp6"/>
</para>
-
+
<section id="dhcp-install-configure">
<title>DHCP Database Installation and Configuration</title>
<para>
@@ -3409,7 +3409,7 @@ $</screen>
</section>
</chapter>
-
+
<chapter id="dhcp4">
<title>The DHCPv4 Server</title>
@@ -3425,16 +3425,16 @@ $</screen>
After starting BIND 10 and entering bindctl, the first step
in configuring the server is to add it to the list of running BIND 10 services.
<screen>
-> <userinput>config add Boss/components b10-dhcp4</userinput>
-> <userinput>config set Boss/components/b10-dhcp4/kind dispensable</userinput>
+> <userinput>config add Init/components b10-dhcp4</userinput>
+> <userinput>config set Init/components/b10-dhcp4/kind dispensable</userinput>
> <userinput>config commit</userinput>
</screen>
</para>
<para>
To remove <command>b10-dhcp4</command> from the set of running services,
- the <command>b10-dhcp4</command> is removed from list of Boss components:
+ the <command>b10-dhcp4</command> is removed from list of Init components:
<screen>
-> <userinput>config remove Boss/components b10-dhcp4</userinput>
+> <userinput>config remove Init/components b10-dhcp4</userinput>
> <userinput>config commit</userinput>
</screen>
</para>
@@ -3502,7 +3502,7 @@ Dhcp4/subnet4 [] list (default)
The server comes with an in-memory database ("memfile") configured as the default
database. This is used for internal testing and is not supported. In addition,
it does not store lease information on disk: lease information will be lost if the
- server is restarted.
+ server is restarted.
</para>
</footnote>, and so the server must be configured to
access the correct database with the appropriate credentials.
@@ -3552,7 +3552,7 @@ Dhcp4/subnet4 [] list (default)
database. Improved password security will be added in a future version of BIND 10 DHCP</para>
</note>
</section>
-
+
<section id="dhcp4-address-config">
<title>Configuration of Address Pools</title>
<para>
@@ -3726,16 +3726,16 @@ Dhcp4/renew-timer 1000 integer (default)
After starting BIND 10 and starting <command>bindctl</command>, the first step
in configuring the server is to add <command>b10-dhcp6</command> to the list of running BIND 10 services.
<screen>
-> <userinput>config add Boss/components b10-dhcp6</userinput>
-> <userinput>config set Boss/components/b10-dhcp6/kind dispensable</userinput>
+> <userinput>config add Init/components b10-dhcp6</userinput>
+> <userinput>config set Init/components/b10-dhcp6/kind dispensable</userinput>
> <userinput>config commit</userinput>
</screen>
</para>
<para>
To remove <command>b10-dhcp6</command> from the set of running services,
- the <command>b10-dhcp4</command> is removed from list of Boss components:
+ the <command>b10-dhcp4</command> is removed from list of Init components:
<screen>
-> <userinput>config remove Boss/components b10-dhcp6</userinput>
+> <userinput>config remove Init/components b10-dhcp6</userinput>
> <userinput>config commit</userinput>
</screen>
</para>
@@ -3782,7 +3782,7 @@ Dhcp6/lease-database/name "" string (default)
Dhcp6/lease-database/user "" string (default)
Dhcp6/lease-database/host "" string (default)
Dhcp6/lease-database/password "" string (default)
-Dhcp6/subnet6/ list
+Dhcp6/subnet6/ list
</screen>
</para>
<para>
@@ -3813,7 +3813,7 @@ Dhcp6/subnet6/ list
The server comes with an in-memory database ("memfile") configured as the default
database. This is used for internal testing and is not supported. In addition,
it does not store lease information on disk: lease information will be lost if the
- server is restarted.
+ server is restarted.
</para>
</footnote>, and so the server must be configured to
access the correct database with the appropriate credentials.
@@ -3959,7 +3959,7 @@ Dhcp6/subnet6/ list
lines for clarity.)
</para>
</section>
-
+
<section id="dhcp6-config-subnets">
<title>Subnet Selection</title>
<para>
@@ -3994,8 +3994,8 @@ Dhcp6/subnet6/ list
> <userinput>config commit</userinput>
</screen>
</para>
- </section>
-
+ </section>
+
</section>
<section id="dhcp6-serverid">
@@ -4164,7 +4164,7 @@ Dhcp6/renew-timer 1000 integer (default)
"queries.tcp": 1749,
"queries.udp": 867868
},
- "Boss": {
+ "Init": {
"boot_time": "2011-01-20T16:59:03Z"
},
"Stats": {
diff --git a/src/bin/auth/b10-auth.xml b/src/bin/auth/b10-auth.xml
index 88f80e2..08a2fde 100644
--- a/src/bin/auth/b10-auth.xml
+++ b/src/bin/auth/b10-auth.xml
@@ -53,8 +53,8 @@
<para>The <command>b10-auth</command> daemon provides the BIND 10
authoritative DNS server.
Normally it is started by the
- <citerefentry><refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- boss process.
+ <citerefentry><refentrytitle>b10-init</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ process.
</para>
<para>
@@ -194,7 +194,7 @@
<command>shutdown</command> exits <command>b10-auth</command>.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the b10-init process may restart this service
if configured.)
</para>
diff --git a/src/bin/auth/main.cc b/src/bin/auth/main.cc
index e90d199..7757b28 100644
--- a/src/bin/auth/main.cc
+++ b/src/bin/auth/main.cc
@@ -187,7 +187,7 @@ main(int argc, char* argv[]) {
// We delay starting listening to new commands/config just before we
// go into the main loop to avoid confusion due to mixture of
// synchronous and asynchronous operations (this would happen in
- // initial communication with the boss that takes place in
+ // initial communication with b10-init that takes place in
// updateConfig() for listen_on and in initializing TSIG keys below).
// Until then all operations on the CC session will take place
// synchronously.
diff --git a/src/bin/bind10/.gitignore b/src/bin/bind10/.gitignore
index 2cf6b50..ce6632d 100644
--- a/src/bin/bind10/.gitignore
+++ b/src/bin/bind10/.gitignore
@@ -1,4 +1,3 @@
-/bind10
-/bind10_src.py
+/b10-init.py
/run_bind10.sh
/bind10.8
diff --git a/src/bin/bind10/Makefile.am b/src/bin/bind10/Makefile.am
index 86c6595..728fc4a 100644
--- a/src/bin/bind10/Makefile.am
+++ b/src/bin/bind10/Makefile.am
@@ -1,29 +1,33 @@
SUBDIRS = . tests
sbin_SCRIPTS = bind10
-CLEANFILES = bind10 bind10_src.pyc
-CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py
-CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.pyc
+pkglibexec_SCRIPTS = b10-init
+CLEANFILES = b10-init b10-init.pyc
+CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/init_messages.py
+CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/init_messages.pyc
pkglibexecdir = $(libexecdir)/@PACKAGE@
-nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py
+nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/init_messages.py
pylogmessagedir = $(pyexecdir)/isc/log_messages/
noinst_SCRIPTS = run_bind10.sh
bind10dir = $(pkgdatadir)
-bind10_DATA = bob.spec
-EXTRA_DIST = bob.spec
+bind10_DATA = init.spec
+EXTRA_DIST = init.spec bind10.in
-man_MANS = bind10.8
-DISTCLEANFILES = $(man_MANS)
-EXTRA_DIST += $(man_MANS) bind10.xml bind10_messages.mes
+man_MANS = b10-init.8 bind10.8
+DISTCLEANFILES = $(man_MANS) bind10
+EXTRA_DIST += $(man_MANS) b10-init.xml bind10.xml init_messages.mes
if GENERATE_DOCS
bind10.8: bind10.xml
- @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/bind10.xml
+ @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/bind10.xml
+
+b10-init.8: b10-init.xml
+ @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/b10-init.xml
#dist-local-check-mans-enabled:
# @if grep "Man generation disabled" $(man_MANS) >/dev/null; then $(RM) $(man_MANS); fi
@@ -40,15 +44,15 @@ $(man_MANS):
endif
-$(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py : bind10_messages.mes
+$(PYTHON_LOGMSGPKG_DIR)/work/init_messages.py : init_messages.mes
$(top_builddir)/src/lib/log/compiler/message \
- -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/bind10_messages.mes
+ -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/init_messages.mes
# this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix
-bind10: bind10_src.py $(PYTHON_LOGMSGPKG_DIR)/work/bind10_messages.py
+b10-init: init.py $(PYTHON_LOGMSGPKG_DIR)/work/init_messages.py
$(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" \
-e "s|@@LIBDIR@@|$(libdir)|" \
- -e "s|@@LIBEXECDIR@@|$(pkglibexecdir)|" bind10_src.py >$@
+ -e "s|@@LIBEXECDIR@@|$(pkglibexecdir)|" init.py >$@
chmod a+x $@
pytest:
diff --git a/src/bin/bind10/README b/src/bin/bind10/README
index e1d2d89..d75c0cd 100644
--- a/src/bin/bind10/README
+++ b/src/bin/bind10/README
@@ -1,11 +1,12 @@
-This directory contains the source for the "Boss of Bind" program.
+This directory contains the source for the "b10-init" program, as well as
+the "bind10" script that runs it.
Files:
Makefile.am - build information
README - this file
TODO - remaining development tasks for this program
bind10.py.in - used to make bind10.py with proper Python paths
- bob.spec - defines the options and commands
+ init.spec - defines the options and commands
run_bind10.sh.in - use to make run_bind10.sh with proper Python paths
The "tests" directory contains unit tests for the application.
diff --git a/src/bin/bind10/b10-init.xml b/src/bin/bind10/b10-init.xml
new file mode 100644
index 0000000..dc8cf7f
--- /dev/null
+++ b/src/bin/bind10/b10-init.xml
@@ -0,0 +1,510 @@
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
+ [<!ENTITY mdash "—">]>
+<!--
+ - Copyright (C) 2010-2012 Internet Systems Consortium, Inc. ("ISC")
+ -
+ - Permission to use, copy, modify, and/or distribute this software for any
+ - purpose with or without fee is hereby granted, provided that the above
+ - copyright notice and this permission notice appear in all copies.
+ -
+ - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ - AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ - PERFORMANCE OF THIS SOFTWARE.
+-->
+
+<refentry>
+
+ <refentryinfo>
+ <date>April 12, 2012</date>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>b10-init</refentrytitle>
+ <manvolnum>8</manvolnum>
+ <refmiscinfo>BIND10</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+ <refname>b10-init</refname>
+ <refpurpose>BIND 10 Init process</refpurpose>
+ </refnamediv>
+
+ <docinfo>
+ <copyright>
+ <year>2010-2012</year>
+ <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
+ </copyright>
+ </docinfo>
+
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>b10-init</command>
+ <arg><option>-c <replaceable>config-filename</replaceable></option></arg>
+ <arg><option>-i</option></arg>
+ <arg><option>-m <replaceable>file</replaceable></option></arg>
+ <arg><option>-p <replaceable>data_path</replaceable></option></arg>
+ <arg><option>-u <replaceable>user</replaceable></option></arg>
+ <arg><option>-v</option></arg>
+ <arg><option>-w <replaceable>wait_time</replaceable></option></arg>
+ <arg><option>--clear-config</option></arg>
+ <arg><option>--cmdctl-port</option> <replaceable>port</replaceable></arg>
+ <arg><option>--config-file</option> <replaceable>config-filename</replaceable></arg>
+ <arg><option>--data-path</option> <replaceable>directory</replaceable></arg>
+ <arg><option>--msgq-socket-file <replaceable>file</replaceable></option></arg>
+ <arg><option>--no-kill</option></arg>
+ <arg><option>--pid-file</option> <replaceable>filename</replaceable></arg>
+ <arg><option>--pretty-name <replaceable>name</replaceable></option></arg>
+ <arg><option>--user <replaceable>user</replaceable></option></arg>
+ <arg><option>--verbose</option></arg>
+ <arg><option>--wait <replaceable>wait_time</replaceable></option></arg>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>DESCRIPTION</title>
+
+ <para>The <command>b10-init</command> daemon starts up other
+ BIND 10 required daemons. It handles restarting of exiting
+ programs and also the shutdown of all managed daemons.</para>
+
+<!-- TODO: list what it starts here? -->
+
+<!-- TODO
+ <para>The configuration of the <command>b10-init</command> daemon
+ is defined in the TODO configuration file, as described in the
+ <citerefentry><refentrytitle>TODO</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ manual page.</para>
+-->
+
+ </refsect1>
+
+ <refsect1>
+ <title>ARGUMENTS</title>
+
+ <para>The arguments are as follows:</para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term>
+ <option>-c</option> <replaceable>config-filename</replaceable>,
+ <option>--config-file</option> <replaceable>config-filename</replaceable>
+ </term>
+ <listitem>
+ <para>The configuration filename to use. Can be either absolute or
+ relative to data path. In case it is absolute, value of data path is
+ not considered.
+ Defaults to <filename>b10-config.db</filename>.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>--clear-config</option>
+ </term>
+ <listitem>
+ <para>
+ This will create a backup of the existing configuration
+ file, remove it and start
+ <refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum>
+ with the default configuration.
+ The name of the backup file can be found in the logs
+ (<varname>CFGMGR_BACKED_UP_CONFIG_FILE</varname>).
+ (It will append a number to the backup filename if a
+ previous backup file exists.)
+
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>--cmdctl-port</option> <replaceable>port</replaceable>
+ </term>
+ <listitem>
+ <para>The <command>b10-cmdctl</command> daemon will listen
+ on this port.
+ (See
+ <refentrytitle>b10-cmdctl</refentrytitle><manvolnum>8</manvolnum>
+ for the default.)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <option>-p</option> <replaceable>directory</replaceable>,
+ <option>--data-path</option> <replaceable>directory</replaceable>
+ </term>
+ <listitem>
+ <para>The path where BIND 10 programs look for various data files.
+ Currently only
+ <citerefentry><refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ uses it to locate the configuration file, but the usage
+ might be extended for other programs and other types of
+ files.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-m</option> <replaceable>file</replaceable>,
+ <option>--msgq-socket-file</option> <replaceable>file</replaceable></term>
+
+ <listitem>
+ <para>The UNIX domain socket file for the
+ <citerefentry><refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ daemon to use.
+ The default is
+ <filename>/usr/local/var/bind10/msg_socket</filename>.
+<!-- @localstatedir@/@PACKAGE_NAME@/msg_socket -->
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-i</option>, <option>--no-kill</option></term>
+ <listitem>
+ <para>When this option is passed, <command>b10-init</command>
+ does not send SIGTERM and SIGKILL signals to modules during
+ shutdown. (This option was introduced for use during
+ testing.)</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-u</option> <replaceable>user</replaceable>, <option>--user</option> <replaceable>name</replaceable></term>
+<!-- TODO: example more detail. -->
+ <listitem>
+ <para>The username for <command>b10-init</command> to run as.
+ <command>b10-init</command> must be initially ran as the
+ root user to use this option.
+ The default is to run as the current user.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--pid-file</option> <replaceable>filename</replaceable></term>
+ <listitem>
+ <para>If defined, the PID of the <command>b10-init</command> is stored
+ in this file.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--pretty-name <replaceable>name</replaceable></option></term>
+
+ <listitem>
+ <para>The name this process should have in tools like
+ <command>ps</command> or <command>top</command>. This
+ is handy if you have multiple versions/installations
+ of <command>b10-init</command>.
+<!-- TODO: only supported with setproctitle feature
+The default is the basename of ARG 0.
+-->
+</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-v</option>, <option>--verbose</option></term>
+ <listitem>
+ <para>Display more about what is going on for
+ <command>b10-init</command> and its child processes.</para>
+<!-- TODO: not true about all children yet -->
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-w</option> <replaceable>wait_time</replaceable>, <option>--wait</option> <replaceable>wait_time</replaceable></term>
+ <listitem>
+ <para>Sets the amount of time that BIND 10 will wait for
+ the configuration manager (a key component of BIND 10)
+ to initialize itself before abandoning the start up and
+ terminating with an error. The
+ <replaceable>wait_time</replaceable> is specified in
+ seconds and has a default value of 10.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect1>
+
+<!--
+TODO: configuration section
+-->
+
+ <refsect1>
+ <title>CONFIGURATION AND COMMANDS</title>
+
+ <para>
+ The configuration provides settings for components for
+ <command>b10-init</command> to manage under
+ <varname>/Init/components/</varname>.
+ The default elements are:
+ </para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para> <varname>/Init/components/b10-cmdctl</varname> </para>
+ </listitem>
+
+ <listitem>
+ <para> <varname>/Init/components/b10-stats</varname> </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ (Note that the startup of <command>b10-sockcreator</command>,
+ <command>b10-cfgmgr</command>, and <command>b10-msgq</command>
+ is not configurable. They are hardcoded and <command>b10-init</command>
+ will not run without them.)
+ </para>
+
+ <para>
+ The named sets for components contain the following settings:
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><varname>address</varname></term>
+ <listitem>
+ <para>The name used for communicating to it on the message
+ bus.</para>
+<!-- NOTE: vorner said:
+These can be null, because the components are special ones, and
+the special class there already knows the address. It is (I hope)
+explained in the guide. I'd like to get rid of the special components
+sometime and I'd like it to teach to guess the address.
+-->
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>kind</varname></term>
+ <listitem>
+ <para>
+ This defines how required a component is.
+ The possible settings for <varname>kind</varname> are:
+ <varname>core</varname> (system won't start if it won't
+ start and <command>b10-init</command> will shutdown if
+ a <quote>core</quote> component crashes),
+ <varname>dispensable</varname> (<command>b10-init</command>
+ will restart failing component),
+ and
+ <varname>needed</varname> (<command>b10-init</command>
+ will shutdown if component won't initially start, but
+ if crashes later, it will attempt to restart).
+ This setting is required.
+<!-- TODO: formatting -->
+ </para>
+ </listitem>
+ </varlistentry>
+
+<!--
+TODO: currently not used
+ <varlistentry>
+ <term> <varname>params</varname> </term>
+ <listitem>
+ <para>
+list
+</para>
+ </listitem>
+ </varlistentry>
+-->
+
+ <varlistentry>
+ <term> <varname>priority</varname> </term>
+ <listitem>
+ <para>This is an integer. <command>b10-init</command>
+ will start the components with largest priority numbers first.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <varname>process</varname> </term>
+ <listitem>
+ <para>This is the filename of the executable to be started.
+ If not defined, then <command>b10-init</command> will
+ use the component name instead.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <varname>special</varname> </term>
+ <listitem>
+ <para>
+ This defines if the component is started a special, hardcoded
+ way.
+<!--
+TODO: document this ... but maybe some of these will be removed
+once we get rid of some using switches for components?
+
+auth
+cfgmgr
+cmdctl
+msgq
+resolver
+sockcreator
+xfrin
+-->
+
+</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+<!-- TODO: formating -->
+ <para>
+ The <varname>Init</varname> configuration commands are:
+ </para>
+
+<!-- TODO -->
+<!--
+ <para>
+ <command>drop_socket</command>
+ This is an internal command and not exposed to the administrator.
+ </para>
+-->
+
+<!-- TODO -->
+<!--
+ <para>
+ <command>get_socket</command>
+ This is an internal command and not exposed to the administrator.
+ </para>
+-->
+
+ <para>
+ <command>getstats</command> tells <command>b10-init</command>
+ to send its statistics data to the <command>b10-stats</command>
+ daemon.
+ This is an internal command and not exposed to the administrator.
+<!-- not defined in spec -->
+ </para>
+
+ <para>
+ <command>ping</command> is used to check the connection with the
+ <command>b10-init</command> daemon.
+ It returns the text <quote>pong</quote>.
+ </para>
+
+ <para>
+ <command>show_processes</command> lists the current processes
+ managed by <command>b10-init</command>.
+ The output is an array in JSON format containing the process
+ ID, the name for each and the address name used on each message bus.
+<!-- TODO: what is name? -->
+<!-- TODO: change to JSON object format? -->
+<!-- TODO: ticket #1406 -->
+ </para>
+
+ <para>
+ <command>shutdown</command> tells <command>b10-init</command>
+ to shutdown the BIND 10 servers.
+ It will tell each process it manages to shutdown and, when
+ complete, <command>b10-init</command> will exit.
+ </para>
+
+ </refsect1>
+
+ <refsect1>
+ <title>STATISTICS DATA</title>
+
+ <para>
+ The statistics data collected by the <command>b10-stats</command>
+ daemon for <quote>Init</quote> include:
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term>boot_time</term>
+ <listitem><para>
+ The date and time that the <command>b10-init</command>
+ process started.
+ This is represented in ISO 8601 format.
+ </para></listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </refsect1>
+
+ <refsect1>
+ <title>FILES</title>
+ <para><filename>sockcreator-XXXXXX/sockcreator</filename>
+ —
+ the Unix Domain socket located in a temporary file directory for
+ <command>b10-sockcreator</command>
+<!-- <citerefentry><refentrytitle>b10-sockcreator</refentrytitle><manvolnum>8</manvolnum></citerefentry> -->
+ communication.
+ </para>
+ </refsect1>
+
+ <refsect1>
+ <title>SEE ALSO</title>
+ <para>
+ <citerefentry>
+ <refentrytitle>bindctl</refentrytitle><manvolnum>1</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-auth</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-cmdctl</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-xfrin</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-xfrout</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-zonemgr</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>b10-stats</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citetitle>BIND 10 Guide</citetitle>.
+ </para>
+ </refsect1>
+<!-- <citerefentry>
+ <refentrytitle>b10-sockcreator</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>, -->
+
+ <refsect1 id='history'><title>HISTORY</title>
+ <para>The development of <command>b10-init</command>
+ was started in October 2009.</para>
+ </refsect1>
+
+ <refsect1>
+ <title>AUTHORS</title>
+ <para>
+ The <command>b10-init</command>
+ daemon was initially designed by Shane Kerr of ISC.
+ </para>
+ </refsect1>
+</refentry><!--
+ - Local variables:
+ - mode: sgml
+ - End:
+-->
diff --git a/src/bin/bind10/bind10.in b/src/bin/bind10/bind10.in
new file mode 100755
index 0000000..fe8c0cc
--- /dev/null
+++ b/src/bin/bind10/bind10.in
@@ -0,0 +1,4 @@
+#!/bin/sh
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+exec @libexecdir@/@PACKAGE@/b10-init $*
diff --git a/src/bin/bind10/bind10.xml b/src/bin/bind10/bind10.xml
index e32544a..f366554 100644
--- a/src/bin/bind10/bind10.xml
+++ b/src/bin/bind10/bind10.xml
@@ -2,7 +2,7 @@
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
[<!ENTITY mdash "—">]>
<!--
- - Copyright (C) 2010-2012 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
@@ -31,12 +31,12 @@
<refnamediv>
<refname>bind10</refname>
- <refpurpose>BIND 10 boss process</refpurpose>
+ <refpurpose>BIND 10 start script</refpurpose>
</refnamediv>
<docinfo>
<copyright>
- <year>2010-2012</year>
+ <year>2013</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
</docinfo>
@@ -44,468 +44,33 @@
<refsynopsisdiv>
<cmdsynopsis>
<command>bind10</command>
- <arg><option>-c <replaceable>config-filename</replaceable></option></arg>
- <arg><option>-i</option></arg>
- <arg><option>-m <replaceable>file</replaceable></option></arg>
- <arg><option>-p <replaceable>data_path</replaceable></option></arg>
- <arg><option>-u <replaceable>user</replaceable></option></arg>
- <arg><option>-v</option></arg>
- <arg><option>-w <replaceable>wait_time</replaceable></option></arg>
- <arg><option>--clear-config</option></arg>
- <arg><option>--cmdctl-port</option> <replaceable>port</replaceable></arg>
- <arg><option>--config-file</option> <replaceable>config-filename</replaceable></arg>
- <arg><option>--data-path</option> <replaceable>directory</replaceable></arg>
- <arg><option>--msgq-socket-file <replaceable>file</replaceable></option></arg>
- <arg><option>--no-kill</option></arg>
- <arg><option>--pid-file</option> <replaceable>filename</replaceable></arg>
- <arg><option>--pretty-name <replaceable>name</replaceable></option></arg>
- <arg><option>--user <replaceable>user</replaceable></option></arg>
- <arg><option>--verbose</option></arg>
- <arg><option>--wait <replaceable>wait_time</replaceable></option></arg>
+ <arg><option>options</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>DESCRIPTION</title>
- <para>The <command>bind10</command> daemon starts up other
- BIND 10 required daemons. It handles restarting of exiting
- programs and also the shutdown of all managed daemons.</para>
+ <para>The <command>bind10</command> script is a simple wrapper that
+ starts BIND10 by running the <command>b10-init</command> daemon. All
+ options passed to <command>bind10</command> are directly passed on to
+ <command>b10-init</command>.</para>
-<!-- TODO: list what it starts here? -->
-
-<!-- TODO
- <para>The configuration of the <command>bind10</command> daemon
- is defined in the TODO configuration file, as described in the
- <citerefentry><refentrytitle>TODO</refentrytitle><manvolnum>5</manvolnum></citerefentry>
- manual page.</para>
--->
-
- </refsect1>
-
- <refsect1>
- <title>ARGUMENTS</title>
-
- <para>The arguments are as follows:</para>
-
- <variablelist>
-
- <varlistentry>
- <term>
- <option>-c</option> <replaceable>config-filename</replaceable>,
- <option>--config-file</option> <replaceable>config-filename</replaceable>
- </term>
- <listitem>
- <para>The configuration filename to use. Can be either absolute or
- relative to data path. In case it is absolute, value of data path is
- not considered.
- Defaults to <filename>b10-config.db</filename>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
- <option>--clear-config</option>
- </term>
- <listitem>
- <para>
- This will create a backup of the existing configuration
- file, remove it and start
- <refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum>
- with the default configuration.
- The name of the backup file can be found in the logs
- (<varname>CFGMGR_BACKED_UP_CONFIG_FILE</varname>).
- (It will append a number to the backup filename if a
- previous backup file exists.)
-
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
- <option>--cmdctl-port</option> <replaceable>port</replaceable>
- </term>
- <listitem>
- <para>The <command>b10-cmdctl</command> daemon will listen
- on this port.
- (See
- <refentrytitle>b10-cmdctl</refentrytitle><manvolnum>8</manvolnum>
- for the default.)
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term>
- <option>-p</option> <replaceable>directory</replaceable>,
- <option>--data-path</option> <replaceable>directory</replaceable>
- </term>
- <listitem>
- <para>The path where BIND 10 programs look for various data files.
- Currently only
- <citerefentry><refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- uses it to locate the configuration file, but the usage
- might be extended for other programs and other types of
- files.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-m</option> <replaceable>file</replaceable>,
- <option>--msgq-socket-file</option> <replaceable>file</replaceable></term>
-
- <listitem>
- <para>The UNIX domain socket file for the
- <citerefentry><refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- daemon to use.
- The default is
- <filename>/usr/local/var/bind10/msg_socket</filename>.
-<!-- @localstatedir@/@PACKAGE_NAME@/msg_socket -->
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-i</option>, <option>--no-kill</option></term>
- <listitem>
- <para>When this option is passed, <command>bind10</command>
- does not send SIGTERM and SIGKILL signals to modules during
- shutdown. (This option was introduced for use during
- testing.)</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-u</option> <replaceable>user</replaceable>, <option>--user</option> <replaceable>name</replaceable></term>
-<!-- TODO: example more detail. -->
- <listitem>
- <para>The username for <command>bind10</command> to run as.
- <command>bind10</command> must be initially ran as the
- root user to use this option.
- The default is to run as the current user.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>--pid-file</option> <replaceable>filename</replaceable></term>
- <listitem>
- <para>If defined, the PID of the <command>bind10</command> is stored
- in this file.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>--pretty-name <replaceable>name</replaceable></option></term>
-
- <listitem>
- <para>The name this process should have in tools like
- <command>ps</command> or <command>top</command>. This
- is handy if you have multiple versions/installations
- of <command>bind10</command>.
-<!-- TODO: only supported with setproctitle feature
-The default is the basename of ARG 0.
--->
-</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-v</option>, <option>--verbose</option></term>
- <listitem>
- <para>Display more about what is going on for
- <command>bind10</command> and its child processes.</para>
-<!-- TODO: not true about all children yet -->
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>-w</option> <replaceable>wait_time</replaceable>, <option>--wait</option> <replaceable>wait_time</replaceable></term>
- <listitem>
- <para>Sets the amount of time that BIND 10 will wait for
- the configuration manager (a key component of BIND 10)
- to initialize itself before abandoning the start up and
- terminating with an error. The
- <replaceable>wait_time</replaceable> is specified in
- seconds and has a default value of 10.
- </para>
- </listitem>
- </varlistentry>
-
- </variablelist>
- </refsect1>
-
-<!--
-TODO: configuration section
--->
-
- <refsect1>
- <title>CONFIGURATION AND COMMANDS</title>
-
- <para>
- The configuration provides settings for components for
- <command>bind10</command> to manage under
- <varname>/Boss/components/</varname>.
- The default elements are:
- </para>
-
- <itemizedlist>
-
- <listitem>
- <para> <varname>/Boss/components/b10-cmdctl</varname> </para>
- </listitem>
-
- <listitem>
- <para> <varname>/Boss/components/b10-stats</varname> </para>
- </listitem>
-
- </itemizedlist>
-
- <para>
- (Note that the startup of <command>b10-sockcreator</command>,
- <command>b10-cfgmgr</command>, and <command>b10-msgq</command>
- is not configurable. They are hardcoded and <command>bind10</command>
- will not run without them.)
- </para>
-
- <para>
- The named sets for components contain the following settings:
- </para>
-
- <variablelist>
-
- <varlistentry>
- <term><varname>address</varname></term>
- <listitem>
- <para>The name used for communicating to it on the message
- bus.</para>
-<!-- NOTE: vorner said:
-These can be null, because the components are special ones, and
-the special class there already knows the address. It is (I hope)
-explained in the guide. I'd like to get rid of the special components
-sometime and I'd like it to teach to guess the address.
--->
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><varname>kind</varname></term>
- <listitem>
- <para>
- This defines how required a component is.
- The possible settings for <varname>kind</varname> are:
- <varname>core</varname> (system won't start if it won't
- start and <command>bind10</command> will shutdown if
- a <quote>core</quote> component crashes),
- <varname>dispensable</varname> (<command>bind10</command>
- will restart failing component),
- and
- <varname>needed</varname> (<command>bind10</command>
- will shutdown if component won't initially start, but
- if crashes later, it will attempt to restart).
- This setting is required.
-<!-- TODO: formatting -->
- </para>
- </listitem>
- </varlistentry>
-
-<!--
-TODO: currently not used
- <varlistentry>
- <term> <varname>params</varname> </term>
- <listitem>
- <para>
-list
-</para>
- </listitem>
- </varlistentry>
--->
-
- <varlistentry>
- <term> <varname>priority</varname> </term>
- <listitem>
- <para>This is an integer. <command>bind10</command>
- will start the components with largest priority numbers first.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term> <varname>process</varname> </term>
- <listitem>
- <para>This is the filename of the executable to be started.
- If not defined, then <command>bind10</command> will
- use the component name instead.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term> <varname>special</varname> </term>
- <listitem>
- <para>
- This defines if the component is started a special, hardcoded
- way.
-<!--
-TODO: document this ... but maybe some of these will be removed
-once we get rid of some using switches for components?
-
-auth
-cfgmgr
-cmdctl
-msgq
-resolver
-sockcreator
-xfrin
--->
-
-</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
-<!-- TODO: formating -->
- <para>
- The <varname>Boss</varname> configuration commands are:
- </para>
-<!-- TODO: let's just let bind10 be known as bind10 and not Boss -->
-
-<!-- TODO -->
-<!--
- <para>
- <command>drop_socket</command>
- This is an internal command and not exposed to the administrator.
- </para>
--->
-
-<!-- TODO -->
-<!--
- <para>
- <command>get_socket</command>
- This is an internal command and not exposed to the administrator.
- </para>
--->
-
- <para>
- <command>getstats</command> tells <command>bind10</command>
- to send its statistics data to the <command>b10-stats</command>
- daemon.
- This is an internal command and not exposed to the administrator.
-<!-- not defined in spec -->
- </para>
-
- <para>
- <command>ping</command> is used to check the connection with the
- <command>bind10</command> daemon.
- It returns the text <quote>pong</quote>.
- </para>
-
- <para>
- <command>show_processes</command> lists the current processes
- managed by <command>bind10</command>.
- The output is an array in JSON format containing the process
- ID, the name for each and the address name used on each message bus.
-<!-- TODO: what is name? -->
-<!-- TODO: change to JSON object format? -->
-<!-- TODO: ticket #1406 -->
- </para>
-
- <para>
- <command>shutdown</command> tells <command>bind10</command>
- to shutdown the BIND 10 servers.
- It will tell each process it manages to shutdown and, when
- complete, <command>bind10</command> will exit.
- </para>
-
- </refsect1>
-
- <refsect1>
- <title>STATISTICS DATA</title>
-
- <para>
- The statistics data collected by the <command>b10-stats</command>
- daemon for <quote>Boss</quote> include:
- </para>
-
- <variablelist>
-
- <varlistentry>
- <term>boot_time</term>
- <listitem><para>
- The date and time that the <command>bind10</command>
- process started.
- This is represented in ISO 8601 format.
- </para></listitem>
- </varlistentry>
-
- </variablelist>
-
- </refsect1>
-
- <refsect1>
- <title>FILES</title>
- <para><filename>sockcreator-XXXXXX/sockcreator</filename>
- —
- the Unix Domain socket located in a temporary file directory for
- <command>b10-sockcreator</command>
-<!-- <citerefentry><refentrytitle>b10-sockcreator</refentrytitle><manvolnum>8</manvolnum></citerefentry> -->
- communication.
- </para>
</refsect1>
<refsect1>
<title>SEE ALSO</title>
<para>
<citerefentry>
- <refentrytitle>bindctl</refentrytitle><manvolnum>1</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-auth</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-cfgmgr</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-cmdctl</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-msgq</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-xfrin</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-xfrout</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-zonemgr</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>,
- <citerefentry>
- <refentrytitle>b10-stats</refentrytitle><manvolnum>8</manvolnum>
+ <refentrytitle>b10-init</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>,
<citetitle>BIND 10 Guide</citetitle>.
</para>
</refsect1>
-<!-- <citerefentry>
- <refentrytitle>b10-sockcreator</refentrytitle><manvolnum>8</manvolnum>
- </citerefentry>, -->
<refsect1 id='history'><title>HISTORY</title>
- <para>The development of <command>bind10</command>
- was started in October 2009.</para>
- </refsect1>
-
- <refsect1>
- <title>AUTHORS</title>
- <para>
- The <command>bind10</command>
- daemon was initially designed by Shane Kerr of ISC.
+ <para>The <command>bind10</command> script was added in Januari 2013
</para>
</refsect1>
-</refentry><!--
- - Local variables:
- - mode: sgml
- - End:
--->
+
+</refentry>
diff --git a/src/bin/bind10/bind10_messages.mes b/src/bin/bind10/bind10_messages.mes
deleted file mode 100644
index 9414ed6..0000000
--- a/src/bin/bind10/bind10_messages.mes
+++ /dev/null
@@ -1,327 +0,0 @@
-# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-# No namespace declaration - these constants go in the global namespace
-# of the xfrin messages python module.
-
-% BIND10_CHECK_MSGQ_ALREADY_RUNNING checking if msgq is already running
-The boss process is starting up and will now check if the message bus
-daemon is already running. If so, it will not be able to start, as it
-needs a dedicated message bus.
-
-% BIND10_COMPONENT_FAILED component %1 (pid %2) failed: %3
-The process terminated, but the bind10 boss didn't expect it to, which means
-it must have failed.
-
-% BIND10_COMPONENT_RESTART component %1 is about to restart
-The named component failed previously and we will try to restart it to provide
-as flawless service as possible, but it should be investigated what happened,
-as it could happen again.
-
-% BIND10_COMPONENT_START component %1 is starting
-The named component is about to be started by the boss process.
-
-% BIND10_COMPONENT_START_EXCEPTION component %1 failed to start: %2
-An exception (mentioned in the message) happened during the startup of the
-named component. The componet is not considered started and further actions
-will be taken about it.
-
-% BIND10_COMPONENT_STOP component %1 is being stopped
-A component is about to be asked to stop willingly by the boss.
-
-% BIND10_COMPONENT_UNSATISFIED component %1 is required to run and failed
-A component failed for some reason (see previous messages). It is either a core
-component or needed component that was just started. In any case, the system
-can't continue without it and will terminate.
-
-% BIND10_CONFIGURATOR_BUILD building plan '%1' -> '%2'
-A debug message. This indicates that the configurator is building a plan
-how to change configuration from the older one to newer one. This does no
-real work yet, it just does the planning what needs to be done.
-
-% BIND10_CONFIGURATOR_PLAN_INTERRUPTED configurator plan interrupted, only %1 of %2 done
-There was an exception during some planned task. The plan will not continue and
-only some tasks of the plan were completed. The rest is aborted. The exception
-will be propagated.
-
-% BIND10_CONFIGURATOR_RECONFIGURE reconfiguring running components
-A different configuration of which components should be running is being
-installed. All components that are no longer needed will be stopped and
-newly introduced ones started. This happens at startup, when the configuration
-is read the first time, or when an operator changes configuration of the boss.
-
-% BIND10_CONFIGURATOR_RUN running plan of %1 tasks
-A debug message. The configurator is about to execute a plan of actions it
-computed previously.
-
-% BIND10_CONFIGURATOR_START bind10 component configurator is starting up
-The part that cares about starting and stopping the right component from the
-boss process is starting up. This happens only once at the startup of the
-boss process. It will start the basic set of processes now (the ones boss
-needs to read the configuration), the rest will be started after the
-configuration is known.
-
-% BIND10_CONFIGURATOR_STOP bind10 component configurator is shutting down
-The part that cares about starting and stopping processes in the boss is
-shutting down. All started components will be shut down now (more precisely,
-asked to terminate by their own, if they fail to comply, other parts of
-the boss process will try to force them).
-
-% BIND10_CONFIGURATOR_TASK performing task %1 on %2
-A debug message. The configurator is about to perform one task of the plan it
-is currently executing on the named component.
-
-% BIND10_CONNECTING_TO_CC_FAIL failed to connect to configuration/command channel; try -v to see output from msgq
-The boss process tried to connect to the communication channel for
-commands and configuration updates during initialization, but it
-failed. This is a fatal startup error, and process will soon
-terminate after some cleanup. There can be several reasons for the
-failure, but the most likely cause is that the msgq daemon failed to
-start, and the most likely cause of the msgq failure is that it
-doesn't have a permission to create a socket file for the
-communication. To confirm that, you can see debug messages from msgq
-by starting BIND 10 with the -v command line option. If it indicates
-permission problem for msgq, make sure the directory where the socket
-file is to be created is writable for the msgq process. Note that if
-you specify the -u option to change process users, the directory must
-be writable for that user.
-
-% BIND10_INVALID_STATISTICS_DATA invalid specification of statistics data specified
-An error was encountered when the boss module specified
-statistics data which is invalid for the boss specification file.
-
-% BIND10_INVALID_USER invalid user: %1
-The boss process was started with the -u option, to drop root privileges
-and continue running as the specified user, but the user is unknown.
-
-% BIND10_KILLING_ALL_PROCESSES killing all started processes
-The boss module was not able to start every process it needed to start
-during startup, and will now kill the processes that did get started.
-
-% BIND10_LOST_SOCKET_CONSUMER consumer %1 of sockets disconnected, considering all its sockets closed
-A connection from one of the applications which requested a socket was
-closed. This means the application has terminated, so all the sockets it was
-using are now closed and bind10 process can release them as well, unless the
-same sockets are used by yet another application.
-
-% BIND10_MSGQ_ALREADY_RUNNING msgq daemon already running, cannot start
-There already appears to be a message bus daemon running. Either an
-old process was not shut down correctly, and needs to be killed, or
-another instance of BIND10, with the same msgq domain socket, is
-running, which needs to be stopped.
-
-% BIND10_MSGQ_DISAPPEARED msgq channel disappeared
-While listening on the message bus channel for messages, it suddenly
-disappeared. The msgq daemon may have died. This might lead to an
-inconsistent state of the system, and BIND 10 will now shut down.
-
-% BIND10_NO_SOCKET couldn't send a socket for token %1 because of error: %2
-An error occurred when the bind10 process was asked to send a socket file
-descriptor. The error is mentioned, most common reason is that the request
-is invalid and may not come from bind10 process at all.
-
-% BIND10_PROCESS_ENDED process %2 of %1 ended with status %3
-This indicates a process started previously terminated. The process id
-and component owning the process are indicated, as well as the exit code.
-This doesn't distinguish if the process was supposed to terminate or not.
-
-% BIND10_READING_BOSS_CONFIGURATION reading boss configuration
-The boss process is starting up, and will now process the initial
-configuration, as received from the configuration manager.
-
-% BIND10_RECEIVED_COMMAND received command: %1
-The boss module received a command and shall now process it. The command
-is printed.
-
-% BIND10_RECEIVED_NEW_CONFIGURATION received new configuration: %1
-The boss module received a configuration update and is going to apply
-it now. The new configuration is printed.
-
-% BIND10_RECEIVED_SIGNAL received signal %1
-The boss module received the given signal.
-
-% BIND10_RESTART_COMPONENT_SKIPPED Skipped restarting a component %1
-The boss module tried to restart a component after it failed (crashed)
-unexpectedly, but the boss then found that the component had been removed
-from its local configuration of components to run. This is an unusual
-situation but can happen if the administrator removes the component from
-the configuration after the component's crash and before the restart time.
-The boss module simply skipped restarting that module, and the whole system
-went back to the expected state (except that the crash itself is likely
-to be a bug).
-
-% BIND10_RESURRECTED_PROCESS resurrected %1 (PID %2)
-The given process has been restarted successfully, and is now running
-with the given process id.
-
-% BIND10_RESURRECTING_PROCESS resurrecting dead %1 process...
-The given process has ended unexpectedly, and is now restarted.
-
-% BIND10_SELECT_ERROR error in select() call: %1
-There was a fatal error in the call to select(), used to see if a child
-process has ended or if there is a message on the message bus. This
-should not happen under normal circumstances and is considered fatal,
-so BIND 10 will now shut down. The specific error is printed.
-
-% BIND10_SEND_SIGKILL sending SIGKILL to %1 (PID %2)
-The boss module is sending a SIGKILL signal to the given process.
-
-% BIND10_SEND_SIGNAL_FAIL sending %1 to %2 (PID %3) failed: %4
-The boss module sent a single (either SIGTERM or SIGKILL) to a process,
-but it failed due to some system level error. There are two major cases:
-the target process has already terminated but the boss module had sent
-the signal before it noticed the termination. In this case an error
-message should indicate something like "no such process". This can be
-safely ignored. The other case is that the boss module doesn't have
-the privilege to send a signal to the process. It can typically
-happen when the boss module started as a privileged process, spawned a
-subprocess, and then dropped the privilege. It includes the case for
-the socket creator when the boss process runs with the -u command line
-option. In this case, the boss module simply gives up to terminate
-the process explicitly because it's unlikely to succeed by keeping
-sending the signal. Although the socket creator is implemented so
-that it will terminate automatically when the boss process exits
-(and that should be the case for any other future process running with
-a higher privilege), but it's recommended to check if there's any
-remaining BIND 10 process if this message is logged. For all other
-cases, the boss module will keep sending the signal until it confirms
-all child processes terminate. Although unlikely, this could prevent
-the boss module from exiting, just keeping sending the signals. So,
-again, it's advisable to check if it really terminates when this
-message is logged.
-
-% BIND10_SEND_SIGTERM sending SIGTERM to %1 (PID %2)
-The boss module is sending a SIGTERM signal to the given process.
-
-% BIND10_SETGID setting GID to %1
-The boss switches the process group ID to the given value. This happens
-when BIND 10 starts with the -u option, and the group ID will be set to
-that of the specified user.
-
-% BIND10_SETUID setting UID to %1
-The boss switches the user it runs as to the given UID.
-
-% BIND10_SHUTDOWN stopping the server
-The boss process received a command or signal telling it to shut down.
-It will send a shutdown command to each process. The processes that do
-not shut down will then receive a SIGTERM signal. If that doesn't work,
-it shall send SIGKILL signals to the processes still alive.
-
-% BIND10_SHUTDOWN_COMPLETE all processes ended, shutdown complete
-All child processes have been stopped, and the boss process will now
-stop itself.
-
-% BIND10_SOCKCREATOR_BAD_CAUSE unknown error cause from socket creator: %1
-The socket creator reported an error when creating a socket. But the function
-which failed is unknown (not one of 'S' for socket or 'B' for bind).
-
-% BIND10_SOCKCREATOR_BAD_RESPONSE unknown response for socket request: %1
-The boss requested a socket from the creator, but the answer is unknown. This
-looks like a programmer error.
-
-% BIND10_SOCKCREATOR_EOF eof while expecting data from socket creator
-There should be more data from the socket creator, but it closed the socket.
-It probably crashed.
-
-% BIND10_SOCKCREATOR_INIT initializing socket creator parser
-The boss module initializes routines for parsing the socket creator
-protocol.
-
-% BIND10_SOCKCREATOR_KILL killing the socket creator
-The socket creator is being terminated the aggressive way, by sending it
-sigkill. This should not happen usually.
-
-% BIND10_SOCKCREATOR_TERMINATE terminating socket creator
-The boss module sends a request to terminate to the socket creator.
-
-% BIND10_SOCKCREATOR_TRANSPORT_ERROR transport error when talking to the socket creator: %1
-Either sending or receiving data from the socket creator failed with the given
-error. The creator probably crashed or some serious OS-level problem happened,
-as the communication happens only on local host.
-
-% BIND10_SOCKET_CREATED successfully created socket %1
-The socket creator successfully created and sent a requested socket, it has
-the given file number.
-
-% BIND10_SOCKET_ERROR error on %1 call in the creator: %2/%3
-The socket creator failed to create the requested socket. It failed on the
-indicated OS API function with given error.
-
-% BIND10_SOCKET_GET requesting socket [%1]:%2 of type %3 from the creator
-The boss forwards a request for a socket to the socket creator.
-
-% BIND10_STARTED_CC started configuration/command session
-Debug message given when BIND 10 has successfully started the object that
-handles configuration and commands.
-
-% BIND10_STARTED_PROCESS started %1
-The given process has successfully been started.
-
-% BIND10_STARTED_PROCESS_PID started %1 (PID %2)
-The given process has successfully been started, and has the given PID.
-
-% BIND10_STARTING starting BIND10: %1
-Informational message on startup that shows the full version.
-
-% BIND10_STARTING_CC starting configuration/command session
-Informational message given when BIND 10 is starting the session object
-that handles configuration and commands.
-
-% BIND10_STARTING_PROCESS starting process %1
-The boss module is starting the given process.
-
-% BIND10_STARTING_PROCESS_PORT starting process %1 (to listen on port %2)
-The boss module is starting the given process, which will listen on the
-given port number.
-
-% BIND10_STARTING_PROCESS_PORT_ADDRESS starting process %1 (to listen on %2#%3)
-The boss module is starting the given process, which will listen on the
-given address and port number (written as <address>#<port>).
-
-% BIND10_STARTUP_COMPLETE BIND 10 started
-All modules have been successfully started, and BIND 10 is now running.
-
-% BIND10_STARTUP_ERROR error during startup: %1
-There was a fatal error when BIND10 was trying to start. The error is
-shown, and BIND10 will now shut down.
-
-% BIND10_STARTUP_UNEXPECTED_MESSAGE unrecognised startup message %1
-During the startup process, a number of messages are exchanged between the
-Boss process and the processes it starts. This error is output when a
-message received by the Boss process is recognised as being of the
-correct format but is unexpected. It may be that processes are starting
-of sequence.
-
-% BIND10_STARTUP_UNRECOGNISED_MESSAGE unrecognised startup message %1
-During the startup process, a number of messages are exchanged between the
-Boss process and the processes it starts. This error is output when a
-message received by the Boss process is not recognised.
-
-% BIND10_STOP_PROCESS asking %1 to shut down
-The boss module is sending a shutdown command to the given module over
-the message channel.
-
-% BIND10_UNKNOWN_CHILD_PROCESS_ENDED unknown child pid %1 exited
-An unknown child process has exited. The PID is printed, but no further
-action will be taken by the boss process.
-
-% BIND10_WAIT_CFGMGR waiting for configuration manager process to initialize
-The configuration manager process is so critical to operation of BIND 10
-that after starting it, the Boss module will wait for it to initialize
-itself before continuing. This debug message is produced during the
-wait and may be output zero or more times depending on how long it takes
-the configuration manager to start up. The total length of time Boss
-will wait for the configuration manager before reporting an error is
-set with the command line --wait switch, which has a default value of
-ten seconds.
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
deleted file mode 100755
index 9f41804..0000000
--- a/src/bin/bind10/bind10_src.py.in
+++ /dev/null
@@ -1,1318 +0,0 @@
-#!@PYTHON@
-
-# Copyright (C) 2010,2011 Internet Systems Consortium.
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
-# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
-# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
-# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-"""
-This file implements the Boss of Bind (BoB, or bob) program.
-
-Its purpose is to start up the BIND 10 system, and then manage the
-processes, by starting and stopping processes, plus restarting
-processes that exit.
-
-To start the system, it first runs the c-channel program (msgq), then
-connects to that. It then runs the configuration manager, and reads
-its own configuration. Then it proceeds to starting other modules.
-
-The Python subprocess module is used for starting processes, but
-because this is not efficient for managing groups of processes,
-SIGCHLD signals are caught and processed using the signal module.
-
-Most of the logic is contained in the BoB class. However, since Python
-requires that signal processing happen in the main thread, we do
-signal handling outside of that class, in the code running for
-__main__.
-"""
-
-import sys; sys.path.append ('@@PYTHONPATH@@')
-import os
-
-# If B10_FROM_SOURCE is set in the environment, we use data files
-# from a directory relative to that, otherwise we use the ones
-# installed on the system
-if "B10_FROM_SOURCE" in os.environ:
- SPECFILE_LOCATION = os.environ["B10_FROM_SOURCE"] + "/src/bin/bind10/bob.spec"
-else:
- PREFIX = "@prefix@"
- DATAROOTDIR = "@datarootdir@"
- SPECFILE_LOCATION = "@datadir@/@PACKAGE@/bob.spec".replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
-
-import subprocess
-import signal
-import re
-import errno
-import time
-import select
-import random
-import socket
-from optparse import OptionParser, OptionValueError
-import io
-import pwd
-import posix
-import copy
-
-from bind10_config import LIBEXECPATH
-import bind10_config
-import isc.cc
-import isc.util.process
-import isc.net.parse
-import isc.log
-from isc.log_messages.bind10_messages import *
-import isc.bind10.component
-import isc.bind10.special_component
-import isc.bind10.socket_cache
-import libutil_io_python
-import tempfile
-
-isc.log.init("b10-boss", buffer=True)
-logger = isc.log.Logger("boss")
-
-# Pending system-wide debug level definitions, the ones we
-# use here are hardcoded for now
-DBG_PROCESS = logger.DBGLVL_TRACE_BASIC
-DBG_COMMANDS = logger.DBGLVL_TRACE_DETAIL
-
-# Messages sent over the unix domain socket to indicate if it is followed by a real socket
-CREATOR_SOCKET_OK = b"1\n"
-CREATOR_SOCKET_UNAVAILABLE = b"0\n"
-
-# RCodes of known exceptions for the get_token command
-CREATOR_SOCKET_ERROR = 2
-CREATOR_SHARE_ERROR = 3
-
-# Assign this process some longer name
-isc.util.process.rename(sys.argv[0])
-
-# This is the version that gets displayed to the user.
-# The VERSION string consists of the module name, the module version
-# number, and the overall BIND 10 version number (set in configure.ac).
-VERSION = "bind10 20110223 (BIND 10 @PACKAGE_VERSION@)"
-
-# This is for boot_time of Boss
-_BASETIME = time.gmtime()
-
-# Detailed error message commonly used on startup failure, possibly due to
-# permission issue regarding log lock file. We dump verbose message because
-# it may not be clear exactly what to do if it simply says
-# "failed to open <filename>: permission denied"
-NOTE_ON_LOCK_FILE = """\
-TIP: if this is about permission error for a lock file, check if the directory
-of the file is writable for the user of the bind10 process; often you need
-to start bind10 as a super user. Also, if you specify the -u option to
-change the user and group, the directory must be writable for the group,
-and the created lock file must be writable for that user. Finally, make sure
-the lock file is not left in the directly before restarting.
-"""
-
-class ProcessInfoError(Exception): pass
-
-class ChangeUserError(Exception):
- '''Exception raised when setuid/setgid fails.
-
- When raised, it's expected to be propagated via underlying component
- management modules to the top level so that it will help provide useful
- fatal error message.
-
- '''
- pass
-
-class ProcessInfo:
- """Information about a process"""
-
- dev_null = open(os.devnull, "w")
-
- def __init__(self, name, args, env={}, dev_null_stdout=False,
- dev_null_stderr=False):
- self.name = name
- self.args = args
- self.env = env
- self.dev_null_stdout = dev_null_stdout
- self.dev_null_stderr = dev_null_stderr
- self.process = None
- self.pid = None
-
- def _preexec_work(self):
- """Function used before running a program that needs to run as a
- different user."""
- # First, put us into a separate process group so we don't get
- # SIGINT signals on Ctrl-C (the boss will shut everthing down by
- # other means).
- os.setpgrp()
-
- def _spawn(self):
- if self.dev_null_stdout:
- spawn_stdout = self.dev_null
- else:
- spawn_stdout = None
- if self.dev_null_stderr:
- spawn_stderr = self.dev_null
- else:
- spawn_stderr = None
- # Environment variables for the child process will be a copy of those
- # of the boss process with any additional specific variables given
- # on construction (self.env).
- spawn_env = copy.deepcopy(os.environ)
- spawn_env.update(self.env)
- spawn_env['PATH'] = LIBEXECPATH + ':' + spawn_env['PATH']
- self.process = subprocess.Popen(self.args,
- stdin=subprocess.PIPE,
- stdout=spawn_stdout,
- stderr=spawn_stderr,
- close_fds=True,
- env=spawn_env,
- preexec_fn=self._preexec_work)
- self.pid = self.process.pid
-
- # spawn() and respawn() are the same for now, but in the future they
- # may have different functionality
- def spawn(self):
- self._spawn()
-
- def respawn(self):
- self._spawn()
-
-class CChannelConnectError(Exception): pass
-
-class ProcessStartError(Exception): pass
-
-class BoB:
- """Boss of BIND class."""
-
- def __init__(self, msgq_socket_file=None, data_path=None,
- config_filename=None, clear_config=False,
- verbose=False, nokill=False, setuid=None, setgid=None,
- username=None, cmdctl_port=None, wait_time=10):
- """
- Initialize the Boss of BIND. This is a singleton (only one can run).
-
- The msgq_socket_file specifies the UNIX domain socket file that the
- msgq process listens on. If verbose is True, then the boss reports
- what it is doing.
-
- Data path and config filename are passed through to config manager
- (if provided) and specify the config file to be used.
-
- The cmdctl_port is passed to cmdctl and specify on which port it
- should listen.
-
- wait_time controls the amount of time (in seconds) that Boss waits
- for selected processes to initialize before continuing with the
- initialization. Currently this is only the configuration manager.
- """
- self.cc_session = None
- self.ccs = None
- self.curproc = None
- self.msgq_socket_file = msgq_socket_file
- self.component_config = {}
- # Some time in future, it may happen that a single component has
- # multple processes (like a pipeline-like component). If so happens,
- # name "components" may be inapropriate. But as the code isn't probably
- # completely ready for it, we leave it at components for now. We also
- # want to support multiple instances of a single component. If it turns
- # out that we'll have a single component with multiple same processes
- # or if we start multiple components with the same configuration (we do
- # this now, but it might change) is an open question.
- self.components = {}
- # Simply list of components that died and need to wait for a
- # restart. Components manage their own restart schedule now
- self.components_to_restart = []
- self.runnable = False
- self.__uid = setuid
- self.__gid = setgid
- self.username = username
- self.verbose = verbose
- self.nokill = nokill
- self.data_path = data_path
- self.config_filename = config_filename
- self.clear_config = clear_config
- self.cmdctl_port = cmdctl_port
- self.wait_time = wait_time
- self.msgq_timeout = 5
-
- # _run_under_unittests is only meant to be used when testing. It
- # bypasses execution of some code to help with testing.
- self._run_under_unittests = False
-
- self._component_configurator = isc.bind10.component.Configurator(self,
- isc.bind10.special_component.get_specials())
- # The priorities here make them start in the correct order. First
- # the socket creator (which would drop root privileges by then),
- # then message queue and after that the config manager (which uses
- # the config manager)
- self.__core_components = {
- 'sockcreator': {
- 'kind': 'core',
- 'special': 'sockcreator',
- 'priority': 200
- },
- 'msgq': {
- 'kind': 'core',
- 'special': 'msgq',
- 'priority': 199
- },
- 'cfgmgr': {
- 'kind': 'core',
- 'special': 'cfgmgr',
- 'priority': 198
- }
- }
- self.__started = False
- self.exitcode = 0
-
- # If -v was set, enable full debug logging.
- if self.verbose:
- logger.set_severity("DEBUG", 99)
- # This is set in init_socket_srv
- self._socket_path = None
- self._socket_cache = None
- self._tmpdir = None
- self._srv_socket = None
- self._unix_sockets = {}
-
- def __propagate_component_config(self, config):
- comps = dict(config)
- # Fill in the core components, so they stay alive
- for comp in self.__core_components:
- if comp in comps:
- raise Exception(comp + " is core component managed by " +
- "bind10 boss, do not set it")
- comps[comp] = self.__core_components[comp]
- # Update the configuration
- self._component_configurator.reconfigure(comps)
-
- def change_user(self):
- '''Change the user and group to those specified on construction.
-
- This method is expected to be called by a component on initial
- startup when the system is ready to switch the user and group
- (i.e., once all components that need the privilege of the original
- user have started).
- '''
- try:
- if self.__gid is not None:
- logger.info(BIND10_SETGID, self.__gid)
- posix.setgid(self.__gid)
- except Exception as ex:
- raise ChangeUserError('failed to change group: ' + str(ex))
-
- try:
- if self.__uid is not None:
- posix.setuid(self.__uid)
- # We use one-shot logger after setuid here. This will
- # detect any permission issue regarding logging due to the
- # result of setuid at the earliest opportunity.
- isc.log.Logger("boss").info(BIND10_SETUID, self.__uid)
- except Exception as ex:
- raise ChangeUserError('failed to change user: ' + str(ex))
-
- def config_handler(self, new_config):
- # If this is initial update, don't do anything now, leave it to startup
- if not self.runnable:
- return
- logger.debug(DBG_COMMANDS, BIND10_RECEIVED_NEW_CONFIGURATION,
- new_config)
- try:
- if 'components' in new_config:
- self.__propagate_component_config(new_config['components'])
- return isc.config.ccsession.create_answer(0)
- except Exception as e:
- return isc.config.ccsession.create_answer(1, str(e))
-
- def get_processes(self):
- pids = list(self.components.keys())
- pids.sort()
- process_list = [ ]
- for pid in pids:
- process_list.append([pid, self.components[pid].name(),
- self.components[pid].address()])
- return process_list
-
- def _get_stats_data(self):
- return { 'boot_time':
- time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
- }
-
- def command_handler(self, command, args):
- logger.debug(DBG_COMMANDS, BIND10_RECEIVED_COMMAND, command)
- answer = isc.config.ccsession.create_answer(1, "command not implemented")
- if type(command) != str:
- answer = isc.config.ccsession.create_answer(1, "bad command")
- else:
- if command == "shutdown":
- self.runnable = False
- answer = isc.config.ccsession.create_answer(0)
- elif command == "getstats":
- answer = isc.config.ccsession.create_answer(
- 0, self._get_stats_data())
- elif command == "ping":
- answer = isc.config.ccsession.create_answer(0, "pong")
- elif command == "show_processes":
- answer = isc.config.ccsession. \
- create_answer(0, self.get_processes())
- elif command == "get_socket":
- answer = self._get_socket(args)
- elif command == "drop_socket":
- if "token" not in args:
- answer = isc.config.ccsession. \
- create_answer(1, "Missing token parameter")
- else:
- try:
- self._socket_cache.drop_socket(args["token"])
- answer = isc.config.ccsession.create_answer(0)
- except Exception as e:
- answer = isc.config.ccsession.create_answer(1, str(e))
- else:
- answer = isc.config.ccsession.create_answer(1,
- "Unknown command")
- return answer
-
- def kill_started_components(self):
- """
- Called as part of the exception handling when a process fails to
- start, this runs through the list of started processes, killing
- each one. It then clears that list.
- """
- logger.info(BIND10_KILLING_ALL_PROCESSES)
- self.__kill_children(True)
- self.components = {}
-
- def _read_bind10_config(self):
- """
- Reads the parameters associated with the BoB module itself.
-
- This means the list of components we should start now.
-
- This could easily be combined into start_all_processes, but
- it stays because of historical reasons and because the tests
- replace the method sometimes.
- """
- logger.info(BIND10_READING_BOSS_CONFIGURATION)
-
- config_data = self.ccs.get_full_config()
- self.__propagate_component_config(config_data['components'])
-
- def log_starting(self, process, port = None, address = None):
- """
- A convenience function to output a "Starting xxx" message if the
- logging is set to DEBUG with debuglevel DBG_PROCESS or higher.
- Putting this into a separate method ensures
- that the output form is consistent across all processes.
-
- The process name (passed as the first argument) is put into
- self.curproc, and is used to indicate which process failed to
- start if there is an error (and is used in the "Started" message
- on success). The optional port and address information are
- appended to the message (if present).
- """
- self.curproc = process
- if port is None and address is None:
- logger.info(BIND10_STARTING_PROCESS, self.curproc)
- elif address is None:
- logger.info(BIND10_STARTING_PROCESS_PORT, self.curproc,
- port)
- else:
- logger.info(BIND10_STARTING_PROCESS_PORT_ADDRESS,
- self.curproc, address, port)
-
- def log_started(self, pid = None):
- """
- A convenience function to output a 'Started xxxx (PID yyyy)'
- message. As with starting_message(), this ensures a consistent
- format.
- """
- if pid is None:
- logger.debug(DBG_PROCESS, BIND10_STARTED_PROCESS, self.curproc)
- else:
- logger.debug(DBG_PROCESS, BIND10_STARTED_PROCESS_PID, self.curproc, pid)
-
- def process_running(self, msg, who):
- """
- Some processes return a message to the Boss after they have
- started to indicate that they are running. The form of the
- message is a dictionary with contents {"running:", "<process>"}.
- This method checks the passed message and returns True if the
- "who" process is contained in the message (so is presumably
- running). It returns False for all other conditions and will
- log an error if appropriate.
- """
- if msg is not None:
- try:
- if msg["running"] == who:
- return True
- else:
- logger.error(BIND10_STARTUP_UNEXPECTED_MESSAGE, msg)
- except:
- logger.error(BIND10_STARTUP_UNRECOGNISED_MESSAGE, msg)
-
- return False
-
- # The next few methods start the individual processes of BIND-10. They
- # are called via start_all_processes(). If any fail, an exception is
- # raised which is caught by the caller of start_all_processes(); this kills
- # processes started up to that point before terminating the program.
-
- def _make_process_info(self, name, args, env,
- dev_null_stdout=False, dev_null_stderr=False):
- """
- Wrapper around ProcessInfo(), useful to override
- ProcessInfo() creation during testing.
- """
- return ProcessInfo(name, args, env, dev_null_stdout, dev_null_stderr)
-
- def start_msgq(self):
- """
- Start the message queue and connect to the command channel.
- """
- self.log_starting("b10-msgq")
- msgq_proc = self._make_process_info("b10-msgq", ["b10-msgq"],
- self.c_channel_env,
- True, not self.verbose)
- msgq_proc.spawn()
- self.log_started(msgq_proc.pid)
-
- # Now connect to the c-channel
- cc_connect_start = time.time()
- while self.cc_session is None:
- # if we are run under unittests, break
- if self._run_under_unittests:
- break
-
- # if we have been trying for "a while" give up
- if (time.time() - cc_connect_start) > self.msgq_timeout:
- if msgq_proc.process:
- msgq_proc.process.kill()
- logger.error(BIND10_CONNECTING_TO_CC_FAIL)
- raise CChannelConnectError("Unable to connect to c-channel after 5 seconds")
-
- # try to connect, and if we can't wait a short while
- try:
- self.cc_session = isc.cc.Session(self.msgq_socket_file)
- except isc.cc.session.SessionError:
- time.sleep(0.1)
-
- # Subscribe to the message queue. The only messages we expect to receive
- # on this channel are once relating to process startup.
- if self.cc_session is not None:
- self.cc_session.group_subscribe("Boss")
-
- return msgq_proc
-
- def start_cfgmgr(self):
- """
- Starts the configuration manager process
- """
- self.log_starting("b10-cfgmgr")
- args = ["b10-cfgmgr"]
- if self.data_path is not None:
- args.append("--data-path=" + self.data_path)
- if self.config_filename is not None:
- args.append("--config-filename=" + self.config_filename)
- if self.clear_config:
- args.append("--clear-config")
- bind_cfgd = self._make_process_info("b10-cfgmgr", args,
- self.c_channel_env)
- bind_cfgd.spawn()
- self.log_started(bind_cfgd.pid)
-
- # Wait for the configuration manager to start up as
- # subsequent initialization cannot proceed without it. The
- # time to wait can be set on the command line.
- time_remaining = self.wait_time
- msg, env = self.cc_session.group_recvmsg()
- while time_remaining > 0 and not self.process_running(msg, "ConfigManager"):
- logger.debug(DBG_PROCESS, BIND10_WAIT_CFGMGR)
- time.sleep(1)
- time_remaining = time_remaining - 1
- msg, env = self.cc_session.group_recvmsg()
-
- if not self.process_running(msg, "ConfigManager"):
- raise ProcessStartError("Configuration manager process has not started")
-
- return bind_cfgd
-
- def start_ccsession(self, c_channel_env):
- """
- Start the CC Session
-
- The argument c_channel_env is unused but is supplied to keep the
- argument list the same for all start_xxx methods.
-
- With regards to logging, note that as the CC session is not a
- process, the log_starting/log_started methods are not used.
- """
- logger.info(BIND10_STARTING_CC)
- self.ccs = isc.config.ModuleCCSession(SPECFILE_LOCATION,
- self.config_handler,
- self.command_handler,
- socket_file = self.msgq_socket_file)
- self.ccs.start()
- logger.debug(DBG_PROCESS, BIND10_STARTED_CC)
-
- # A couple of utility methods for starting processes...
-
- def start_process(self, name, args, c_channel_env, port=None, address=None):
- """
- Given a set of command arguments, start the process and output
- appropriate log messages. If the start is successful, the process
- is added to the list of started processes.
-
- The port and address arguments are for log messages only.
- """
- self.log_starting(name, port, address)
- newproc = self._make_process_info(name, args, c_channel_env)
- newproc.spawn()
- self.log_started(newproc.pid)
- return newproc
-
- def register_process(self, pid, component):
- """
- Put another process into boss to watch over it. When the process
- dies, the component.failed() is called with the exit code.
-
- It is expected the info is a isc.bind10.component.BaseComponent
- subclass (or anything having the same interface).
- """
- self.components[pid] = component
-
- def start_simple(self, name):
- """
- Most of the BIND-10 processes are started with the command:
-
- <process-name> [-v]
-
- ... where -v is appended if verbose is enabled. This method
- generates the arguments from the name and starts the process.
-
- The port and address arguments are for log messages only.
- """
- # Set up the command arguments.
- args = [name]
- if self.verbose:
- args += ['-v']
-
- # ... and start the process
- return self.start_process(name, args, self.c_channel_env)
-
- # The next few methods start up the rest of the BIND-10 processes.
- # Although many of these methods are little more than a call to
- # start_simple, they are retained (a) for testing reasons and (b) as a place
- # where modifications can be made if the process start-up sequence changes
- # for a given process.
-
- def start_auth(self):
- """
- Start the Authoritative server
- """
- authargs = ['b10-auth']
- if self.verbose:
- authargs += ['-v']
-
- # ... and start
- return self.start_process("b10-auth", authargs, self.c_channel_env)
-
- def start_resolver(self):
- """
- Start the Resolver. At present, all these arguments and switches
- are pure speculation. As with the auth daemon, they should be
- read from the configuration database.
- """
- self.curproc = "b10-resolver"
- # XXX: this must be read from the configuration manager in the future
- resargs = ['b10-resolver']
- if self.verbose:
- resargs += ['-v']
-
- # ... and start
- return self.start_process("b10-resolver", resargs, self.c_channel_env)
-
- def start_cmdctl(self):
- """
- Starts the command control process
- """
- args = ["b10-cmdctl"]
- if self.cmdctl_port is not None:
- args.append("--port=" + str(self.cmdctl_port))
- if self.verbose:
- args.append("-v")
- return self.start_process("b10-cmdctl", args, self.c_channel_env,
- self.cmdctl_port)
-
- def start_all_components(self):
- """
- Starts up all the components. Any exception generated during the
- starting of the components is handled by the caller.
- """
- # Start the real core (sockcreator, msgq, cfgmgr)
- self._component_configurator.startup(self.__core_components)
-
- # Connect to the msgq. This is not a process, so it's not handled
- # inside the configurator.
- self.start_ccsession(self.c_channel_env)
-
- # Extract the parameters associated with Bob. This can only be
- # done after the CC Session is started. Note that the logging
- # configuration may override the "-v" switch set on the command line.
- self._read_bind10_config()
-
- # TODO: Return the dropping of privileges
-
- def startup(self):
- """
- Start the BoB instance.
-
- Returns None if successful, otherwise an string describing the
- problem.
- """
- # Try to connect to the c-channel daemon, to see if it is already
- # running
- c_channel_env = {}
- if self.msgq_socket_file is not None:
- c_channel_env["BIND10_MSGQ_SOCKET_FILE"] = self.msgq_socket_file
- logger.debug(DBG_PROCESS, BIND10_CHECK_MSGQ_ALREADY_RUNNING)
- try:
- self.cc_session = isc.cc.Session(self.msgq_socket_file)
- logger.fatal(BIND10_MSGQ_ALREADY_RUNNING)
- return "b10-msgq already running, or socket file not cleaned , cannot start"
- except isc.cc.session.SessionError:
- # this is the case we want, where the msgq is not running
- pass
-
- # Start all components. If any one fails to start, kill all started
- # components and exit with an error indication.
- try:
- self.c_channel_env = c_channel_env
- self.start_all_components()
- except ChangeUserError as e:
- self.kill_started_components()
- return str(e) + '; ' + NOTE_ON_LOCK_FILE.replace('\n', ' ')
- except Exception as e:
- self.kill_started_components()
- return "Unable to start " + self.curproc + ": " + str(e)
-
- # Started successfully
- self.runnable = True
- self.__started = True
- return None
-
- def stop_process(self, process, recipient, pid):
- """
- Stop the given process, friendly-like. The process is the name it has
- (in logs, etc), the recipient is the address on msgq. The pid is the
- pid of the process (if we have multiple processes of the same name,
- it might want to choose if it is for this one).
- """
- logger.info(BIND10_STOP_PROCESS, process)
- self.cc_session.group_sendmsg(isc.config.ccsession.
- create_command('shutdown', {'pid': pid}),
- recipient, recipient)
-
- def component_shutdown(self, exitcode=0):
- """
- Stop the Boss instance from a components' request. The exitcode
- indicates the desired exit code.
-
- If we did not start yet, it raises an exception, which is meant
- to propagate through the component and configurator to the startup
- routine and abort the startup immediately. If it is started up already,
- we just mark it so we terminate soon.
-
- It does set the exit code in both cases.
- """
- self.exitcode = exitcode
- if not self.__started:
- raise Exception("Component failed during startup");
- else:
- self.runnable = False
-
- def shutdown(self):
- """Stop the BoB instance."""
- logger.info(BIND10_SHUTDOWN)
- # If ccsession is still there, inform rest of the system this module
- # is stopping. Since everything will be stopped shortly, this is not
- # really necessary, but this is done to reflect that boss is also
- # 'just' a module.
- self.ccs.send_stopping()
-
- # try using the BIND 10 request to stop
- try:
- self._component_configurator.shutdown()
- except:
- pass
- # XXX: some delay probably useful... how much is uncertain
- # I have changed the delay from 0.5 to 1, but sometime it's
- # still not enough.
- time.sleep(1)
- self.reap_children()
-
- # Send TERM and KILL signals to modules if we're not prevented
- # from doing so
- if not self.nokill:
- # next try sending a SIGTERM
- self.__kill_children(False)
- # finally, send SIGKILL (unmaskable termination) until everybody
- # dies
- while self.components:
- # XXX: some delay probably useful... how much is uncertain
- time.sleep(0.1)
- self.reap_children()
- self.__kill_children(True)
- logger.info(BIND10_SHUTDOWN_COMPLETE)
-
- def __kill_children(self, forceful):
- '''Terminate remaining subprocesses by sending a signal.
-
- The forceful paramter will be passed Component.kill().
- This is a dedicated subroutine of shutdown(), just to unify two
- similar cases.
-
- '''
- logmsg = BIND10_SEND_SIGKILL if forceful else BIND10_SEND_SIGTERM
- # We need to make a copy of values as the components may be modified
- # in the loop.
- for component in list(self.components.values()):
- logger.info(logmsg, component.name(), component.pid())
- try:
- component.kill(forceful)
- except OSError as ex:
- # If kill() failed due to EPERM, it doesn't make sense to
- # keep trying, so we just log the fact and forget that
- # component. Ignore other OSErrors (usually ESRCH because
- # the child finally exited)
- signame = "SIGKILL" if forceful else "SIGTERM"
- logger.info(BIND10_SEND_SIGNAL_FAIL, signame,
- component.name(), component.pid(), ex)
- if ex.errno == errno.EPERM:
- del self.components[component.pid()]
-
- def _get_process_exit_status(self):
- return os.waitpid(-1, os.WNOHANG)
-
- def reap_children(self):
- """Check to see if any of our child processes have exited,
- and note this for later handling.
- """
- while True:
- try:
- (pid, exit_status) = self._get_process_exit_status()
- except OSError as o:
- if o.errno == errno.ECHILD:
- break
- # XXX: should be impossible to get any other error here
- raise
- if pid == 0:
- break
- if pid in self.components:
- # One of the components we know about. Get information on it.
- component = self.components.pop(pid)
- logger.info(BIND10_PROCESS_ENDED, component.name(), pid,
- exit_status)
- if component.is_running() and self.runnable:
- # Tell it it failed. But only if it matters (we are
- # not shutting down and the component considers itself
- # to be running.
- component_restarted = component.failed(exit_status);
- # if the process wants to be restarted, but not just yet,
- # it returns False
- if not component_restarted:
- self.components_to_restart.append(component)
- else:
- logger.info(BIND10_UNKNOWN_CHILD_PROCESS_ENDED, pid)
-
- def restart_processes(self):
- """
- Restart any dead processes:
-
- * Returns the time when the next process is ready to be restarted.
- * If the server is shutting down, returns 0.
- * If there are no processes, returns None.
-
- The values returned can be safely passed into select() as the
- timeout value.
-
- """
- if not self.runnable:
- return 0
- still_dead = []
- # keep track of the first time we need to check this queue again,
- # if at all
- next_restart_time = None
- now = time.time()
- for component in self.components_to_restart:
- # If the component was removed from the configurator between since
- # scheduled to restart, just ignore it. The object will just be
- # dropped here.
- if not self._component_configurator.has_component(component):
- logger.info(BIND10_RESTART_COMPONENT_SKIPPED, component.name())
- elif not component.restart(now):
- still_dead.append(component)
- if next_restart_time is None or\
- next_restart_time > component.get_restart_time():
- next_restart_time = component.get_restart_time()
- self.components_to_restart = still_dead
-
- return next_restart_time
-
- def _get_socket(self, args):
- """
- Implementation of the get_socket CC command. It asks the cache
- to provide the token and sends the information back.
- """
- try:
- try:
- addr = isc.net.parse.addr_parse(args['address'])
- port = isc.net.parse.port_parse(args['port'])
- protocol = args['protocol']
- if protocol not in ['UDP', 'TCP']:
- raise ValueError("Protocol must be either UDP or TCP")
- share_mode = args['share_mode']
- if share_mode not in ['ANY', 'SAMEAPP', 'NO']:
- raise ValueError("Share mode must be one of ANY, SAMEAPP" +
- " or NO")
- share_name = args['share_name']
- except KeyError as ke:
- return \
- isc.config.ccsession.create_answer(1,
- "Missing parameter " +
- str(ke))
-
- # FIXME: This call contains blocking IPC. It is expected to be
- # short, but if it turns out to be problem, we'll need to do
- # something about it.
- token = self._socket_cache.get_token(protocol, addr, port,
- share_mode, share_name)
- return isc.config.ccsession.create_answer(0, {
- 'token': token,
- 'path': self._socket_path
- })
- except isc.bind10.socket_cache.SocketError as e:
- return isc.config.ccsession.create_answer(CREATOR_SOCKET_ERROR,
- str(e))
- except isc.bind10.socket_cache.ShareError as e:
- return isc.config.ccsession.create_answer(CREATOR_SHARE_ERROR,
- str(e))
- except Exception as e:
- return isc.config.ccsession.create_answer(1, str(e))
-
- def socket_request_handler(self, token, unix_socket):
- """
- This function handles a token that comes over a unix_domain socket.
- The function looks into the _socket_cache and sends the socket
- identified by the token back over the unix_socket.
- """
- try:
- token = str(token, 'ASCII') # Convert from bytes to str
- fd = self._socket_cache.get_socket(token, unix_socket.fileno())
- # FIXME: These two calls are blocking in their nature. An OS-level
- # buffer is likely to be large enough to hold all these data, but
- # if it wasn't and the remote application got stuck, we would have
- # a problem. If there appear such problems, we should do something
- # about it.
- unix_socket.sendall(CREATOR_SOCKET_OK)
- libutil_io_python.send_fd(unix_socket.fileno(), fd)
- except Exception as e:
- logger.info(BIND10_NO_SOCKET, token, e)
- unix_socket.sendall(CREATOR_SOCKET_UNAVAILABLE)
-
- def socket_consumer_dead(self, unix_socket):
- """
- This function handles when a unix_socket closes. This means all
- sockets sent to it are to be considered closed. This function signals
- so to the _socket_cache.
- """
- logger.info(BIND10_LOST_SOCKET_CONSUMER, unix_socket.fileno())
- try:
- self._socket_cache.drop_application(unix_socket.fileno())
- except ValueError:
- # This means the application holds no sockets. It's harmless, as it
- # can happen in real life - for example, it requests a socket, but
- # get_socket doesn't find it, so the application dies. It should be
- # rare, though.
- pass
-
- def set_creator(self, creator):
- """
- Registeres a socket creator into the boss. The socket creator is not
- used directly, but through a cache. The cache is created in this
- method.
-
- If called more than once, it raises a ValueError.
- """
- if self._socket_cache is not None:
- raise ValueError("A creator was inserted previously")
- self._socket_cache = isc.bind10.socket_cache.Cache(creator)
-
- def init_socket_srv(self):
- """
- Creates and listens on a unix-domain socket to be able to send out
- the sockets.
-
- This method should be called after switching user, or the switched
- applications won't be able to access the socket.
- """
- self._srv_socket = socket.socket(socket.AF_UNIX)
- # We create a temporary directory somewhere safe and unique, to avoid
- # the need to find the place ourself or bother users. Also, this
- # secures the socket on some platforms, as it creates a private
- # directory.
- self._tmpdir = tempfile.mkdtemp(prefix='sockcreator-')
- # Get the name
- self._socket_path = os.path.join(self._tmpdir, "sockcreator")
- # And bind the socket to the name
- self._srv_socket.bind(self._socket_path)
- self._srv_socket.listen(5)
-
- def remove_socket_srv(self):
- """
- Closes and removes the listening socket and the directory where it
- lives, as we created both.
-
- It does nothing if the _srv_socket is not set (eg. it was not yet
- initialized).
- """
- if self._srv_socket is not None:
- self._srv_socket.close()
- if os.path.exists(self._socket_path):
- os.remove(self._socket_path)
- if os.path.isdir(self._tmpdir):
- os.rmdir(self._tmpdir)
-
- def _srv_accept(self):
- """
- Accept a socket from the unix domain socket server and put it to the
- others we care about.
- """
- (socket, conn) = self._srv_socket.accept()
- self._unix_sockets[socket.fileno()] = (socket, b'')
-
- def _socket_data(self, socket_fileno):
- """
- This is called when a socket identified by the socket_fileno needs
- attention. We try to read data from there. If it is closed, we remove
- it.
- """
- (sock, previous) = self._unix_sockets[socket_fileno]
- while True:
- try:
- data = sock.recv(1, socket.MSG_DONTWAIT)
- except socket.error as se:
- # These two might be different on some systems
- if se.errno == errno.EAGAIN or se.errno == errno.EWOULDBLOCK:
- # No more data now. Oh, well, just store what we have.
- self._unix_sockets[socket_fileno] = (sock, previous)
- return
- else:
- data = b'' # Pretend it got closed
- if len(data) == 0: # The socket got to it's end
- del self._unix_sockets[socket_fileno]
- self.socket_consumer_dead(sock)
- sock.close()
- return
- else:
- if data == b"\n":
- # Handle this token and clear it
- self.socket_request_handler(previous, sock)
- previous = b''
- else:
- previous += data
-
- def run(self, wakeup_fd):
- """
- The main loop, waiting for sockets, commands and dead processes.
- Runs as long as the runnable is true.
-
- The wakeup_fd descriptor is the read end of pipe where CHLD signal
- handler writes.
- """
- ccs_fd = self.ccs.get_socket().fileno()
- while self.runnable:
- # clean up any processes that exited
- self.reap_children()
- next_restart = self.restart_processes()
- if next_restart is None:
- wait_time = None
- else:
- wait_time = max(next_restart - time.time(), 0)
-
- # select() can raise EINTR when a signal arrives,
- # even if they are resumable, so we have to catch
- # the exception
- try:
- (rlist, wlist, xlist) = \
- select.select([wakeup_fd, ccs_fd,
- self._srv_socket.fileno()] +
- list(self._unix_sockets.keys()), [], [],
- wait_time)
- except select.error as err:
- if err.args[0] == errno.EINTR:
- (rlist, wlist, xlist) = ([], [], [])
- else:
- logger.fatal(BIND10_SELECT_ERROR, err)
- break
-
- for fd in rlist + xlist:
- if fd == ccs_fd:
- try:
- self.ccs.check_command()
- except isc.cc.session.ProtocolError:
- logger.fatal(BIND10_MSGQ_DISAPPEARED)
- self.runnable = False
- break
- elif fd == wakeup_fd:
- os.read(wakeup_fd, 32)
- elif fd == self._srv_socket.fileno():
- self._srv_accept()
- elif fd in self._unix_sockets:
- self._socket_data(fd)
-
-# global variables, needed for signal handlers
-options = None
-boss_of_bind = None
-
-def reaper(signal_number, stack_frame):
- """A child process has died (SIGCHLD received)."""
- # don't do anything...
- # the Python signal handler has been set up to write
- # down a pipe, waking up our select() bit
- pass
-
-def get_signame(signal_number):
- """Return the symbolic name for a signal."""
- for sig in dir(signal):
- if sig.startswith("SIG") and sig[3].isalnum():
- if getattr(signal, sig) == signal_number:
- return sig
- return "Unknown signal %d" % signal_number
-
-# XXX: perhaps register atexit() function and invoke that instead
-def fatal_signal(signal_number, stack_frame):
- """We need to exit (SIGINT or SIGTERM received)."""
- global options
- global boss_of_bind
- logger.info(BIND10_RECEIVED_SIGNAL, get_signame(signal_number))
- signal.signal(signal.SIGCHLD, signal.SIG_DFL)
- boss_of_bind.runnable = False
-
-def process_rename(option, opt_str, value, parser):
- """Function that renames the process if it is requested by a option."""
- isc.util.process.rename(value)
-
-def parse_args(args=sys.argv[1:], Parser=OptionParser):
- """
- Function for parsing command line arguments. Returns the
- options object from OptionParser.
- """
- parser = Parser(version=VERSION)
- parser.add_option("-m", "--msgq-socket-file", dest="msgq_socket_file",
- type="string", default=None,
- help="UNIX domain socket file the b10-msgq daemon will use")
- parser.add_option("-i", "--no-kill", action="store_true", dest="nokill",
- default=False, help="do not send SIGTERM and SIGKILL signals to modules during shutdown")
- parser.add_option("-u", "--user", dest="user", type="string", default=None,
- help="Change user after startup (must run as root)")
- parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
- help="display more about what is going on")
- parser.add_option("--pretty-name", type="string", action="callback",
- callback=process_rename,
- help="Set the process name (displayed in ps, top, ...)")
- parser.add_option("-c", "--config-file", action="store",
- dest="config_file", default=None,
- help="Configuration database filename")
- parser.add_option("--clear-config", action="store_true",
- dest="clear_config", default=False,
- help="Create backup of the configuration file and " +
- "start with a clean configuration")
- parser.add_option("-p", "--data-path", dest="data_path",
- help="Directory to search for configuration files",
- default=None)
- parser.add_option("--cmdctl-port", dest="cmdctl_port", type="int",
- default=None, help="Port of command control")
- parser.add_option("--pid-file", dest="pid_file", type="string",
- default=None,
- help="file to dump the PID of the BIND 10 process")
- parser.add_option("-w", "--wait", dest="wait_time", type="int",
- default=10, help="Time (in seconds) to wait for config manager to start up")
-
- (options, args) = parser.parse_args(args)
-
- if options.cmdctl_port is not None:
- try:
- isc.net.parse.port_parse(options.cmdctl_port)
- except ValueError as e:
- parser.error(e)
-
- if args:
- parser.print_help()
- sys.exit(1)
-
- return options
-
-def dump_pid(pid_file):
- """
- Dump the PID of the current process to the specified file. If the given
- file is None this function does nothing. If the file already exists,
- the existing content will be removed. If a system error happens in
- creating or writing to the file, the corresponding exception will be
- propagated to the caller.
- """
- if pid_file is None:
- return
- f = open(pid_file, "w")
- f.write('%d\n' % os.getpid())
- f.close()
-
-def unlink_pid_file(pid_file):
- """
- Remove the given file, which is basically expected to be the PID file
- created by dump_pid(). The specified may or may not exist; if it
- doesn't this function does nothing. Other system level errors in removing
- the file will be propagated as the corresponding exception.
- """
- if pid_file is None:
- return
- try:
- os.unlink(pid_file)
- except OSError as error:
- if error.errno is not errno.ENOENT:
- raise
-
-def remove_lock_files():
- """
- Remove various lock files which were created by code such as in the
- logger. This function should be called after BIND 10 shutdown.
- """
-
- lockfiles = ["logger_lockfile"]
-
- lpath = bind10_config.DATA_PATH
- if "B10_FROM_BUILD" in os.environ:
- lpath = os.environ["B10_FROM_BUILD"]
- if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
- lpath = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"]
- if "B10_LOCKFILE_DIR_FROM_BUILD" in os.environ:
- lpath = os.environ["B10_LOCKFILE_DIR_FROM_BUILD"]
-
- for f in lockfiles:
- fname = lpath + '/' + f
- if os.path.isfile(fname):
- try:
- os.unlink(fname)
- except OSError as e:
- # We catch and ignore permission related error on unlink.
- # This can happen if bind10 started with -u, created a lock
- # file as a privileged user, but the directory is not writable
- # for the changed user. This setup will cause immediate
- # start failure, and we leave verbose error message including
- # the leftover lock file, so it should be acceptable to ignore
- # it (note that it doesn't make sense to log this event at
- # this poitn)
- if e.errno != errno.EPERM and e.errno != errno.EACCES:
- raise
-
- return
-
-def main():
- global options
- global boss_of_bind
- # Enforce line buffering on stdout, even when not a TTY
- sys.stdout = io.TextIOWrapper(sys.stdout.detach(), line_buffering=True)
-
- options = parse_args()
-
- # Announce startup. Making this is the first log message.
- try:
- logger.info(BIND10_STARTING, VERSION)
- except RuntimeError as e:
- sys.stderr.write('ERROR: failed to write the initial log: %s\n' %
- str(e))
- sys.stderr.write(NOTE_ON_LOCK_FILE)
- sys.exit(1)
-
- # Check user ID.
- setuid = None
- setgid = None
- username = None
- if options.user:
- # Try getting information about the user, assuming UID passed.
- try:
- pw_ent = pwd.getpwuid(int(options.user))
- setuid = pw_ent.pw_uid
- setgid = pw_ent.pw_gid
- username = pw_ent.pw_name
- except ValueError:
- pass
- except KeyError:
- pass
-
- # Next try getting information about the user, assuming user name
- # passed.
- # If the information is both a valid user name and user number, we
- # prefer the name because we try it second. A minor point, hopefully.
- try:
- pw_ent = pwd.getpwnam(options.user)
- setuid = pw_ent.pw_uid
- setgid = pw_ent.pw_gid
- username = pw_ent.pw_name
- except KeyError:
- pass
-
- if setuid is None:
- logger.fatal(BIND10_INVALID_USER, options.user)
- sys.exit(1)
-
- # Create wakeup pipe for signal handlers
- wakeup_pipe = os.pipe()
- signal.set_wakeup_fd(wakeup_pipe[1])
-
- # Set signal handlers for catching child termination, as well
- # as our own demise.
- signal.signal(signal.SIGCHLD, reaper)
- signal.siginterrupt(signal.SIGCHLD, False)
- signal.signal(signal.SIGINT, fatal_signal)
- signal.signal(signal.SIGTERM, fatal_signal)
-
- # Block SIGPIPE, as we don't want it to end this process
- signal.signal(signal.SIGPIPE, signal.SIG_IGN)
-
- try:
- # Go bob!
- boss_of_bind = BoB(options.msgq_socket_file, options.data_path,
- options.config_file, options.clear_config,
- options.verbose, options.nokill,
- setuid, setgid, username, options.cmdctl_port,
- options.wait_time)
- startup_result = boss_of_bind.startup()
- if startup_result:
- logger.fatal(BIND10_STARTUP_ERROR, startup_result)
- sys.exit(1)
- boss_of_bind.init_socket_srv()
- logger.info(BIND10_STARTUP_COMPLETE)
- dump_pid(options.pid_file)
-
- # Let it run
- boss_of_bind.run(wakeup_pipe[0])
-
- # shutdown
- signal.signal(signal.SIGCHLD, signal.SIG_DFL)
- boss_of_bind.shutdown()
- finally:
- # Clean up the filesystem
- unlink_pid_file(options.pid_file)
- remove_lock_files()
- if boss_of_bind is not None:
- boss_of_bind.remove_socket_srv()
- sys.exit(boss_of_bind.exitcode)
-
-if __name__ == "__main__":
- main()
diff --git a/src/bin/bind10/bob.spec b/src/bin/bind10/bob.spec
deleted file mode 100644
index 442d46f..0000000
--- a/src/bin/bind10/bob.spec
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "module_spec": {
- "module_name": "Boss",
- "module_description": "Master process",
- "config_data": [
- {
- "item_name": "components",
- "item_type": "named_set",
- "item_optional": false,
- "item_default": {
- "b10-stats": { "address": "Stats", "kind": "dispensable" },
- "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
- },
- "named_set_item_spec": {
- "item_name": "component",
- "item_type": "map",
- "item_optional": false,
- "item_default": { },
- "map_item_spec": [
- {
- "item_name": "special",
- "item_optional": true,
- "item_type": "string"
- },
- {
- "item_name": "process",
- "item_optional": true,
- "item_type": "string"
- },
- {
- "item_name": "kind",
- "item_optional": false,
- "item_type": "string",
- "item_default": "dispensable"
- },
- {
- "item_name": "address",
- "item_optional": true,
- "item_type": "string"
- },
- {
- "item_name": "params",
- "item_optional": true,
- "item_type": "list",
- "list_item_spec": {
- "item_name": "param",
- "item_optional": false,
- "item_type": "string",
- "item_default": ""
- }
- },
- {
- "item_name": "priority",
- "item_optional": true,
- "item_type": "integer"
- }
- ]
- }
- }
- ],
- "commands": [
- {
- "command_name": "shutdown",
- "command_description": "Shut down BIND 10",
- "command_args": []
- },
- {
- "command_name": "ping",
- "command_description": "Ping the boss process",
- "command_args": []
- },
- {
- "command_name": "show_processes",
- "command_description": "List the running BIND 10 processes",
- "command_args": []
- }
- ],
- "statistics": [
- {
- "item_name": "boot_time",
- "item_type": "string",
- "item_optional": false,
- "item_default": "1970-01-01T00:00:00Z",
- "item_title": "Boot time",
- "item_description": "A date time when bind10 process starts initially",
- "item_format": "date-time"
- }
- ]
- }
-}
-
-
diff --git a/src/bin/bind10/creatorapi.txt b/src/bin/bind10/creatorapi.txt
index c23d907..d3e67f4 100644
--- a/src/bin/bind10/creatorapi.txt
+++ b/src/bin/bind10/creatorapi.txt
@@ -1,7 +1,7 @@
Socket creator API
==================
-This API is between Boss and other modules to allow them requesting of sockets.
+This API is between Init and other modules to allow them requesting of sockets.
For simplicity, we will use the socket creator for all (even non-privileged)
ports for now, but we should have some function where we can abstract it later.
@@ -25,12 +25,12 @@ It seems we are stuck with current msgq for a while and there's a chance the
new replacement will not be able to send sockets inbound. So, we need another
channel.
-The boss will create a unix-domain socket and listen on it. When something
+b10-init will create a unix-domain socket and listen on it. When something
requests a socket over the command channel and the socket is created, some kind
of token is returned to the application (which will represent the future
socket). The application then connects to the unix-domain socket, sends the
-token over the connection (so Boss will know which socket to send there, in case
-multiple applications ask for sockets simultaneously) and Boss sends the socket
+token over the connection (so Init will know which socket to send there, in case
+multiple applications ask for sockets simultaneously) and Init sends the socket
in return.
In theory, we could send the requests directly over the unix-domain
@@ -48,8 +48,8 @@ socket, but it has two disadvantages:
Caching of sockets
------------------
-To allow sending the same socket to multiple application, the Boss process will
-hold a cache. Each socket that is created and sent is kept open in Boss and
+To allow sending the same socket to multiple application, the Init process will
+hold a cache. Each socket that is created and sent is kept open in Init and
preserved there as well. A reference count is kept with each of them.
When another application asks for the same socket, it is simply sent from the
@@ -60,14 +60,14 @@ command channel), the reference count can be decreased without problems. But
when the application terminates or crashes, we need to decrease it as well.
There's a problem, since we don't know which command channel connection (eg.
lname) belongs to which PID. Furthermore, the applications don't need to be
-started by boss.
+started by b10-init.
There are two possibilities:
* Let the msgq send messages about disconnected clients (eg. group message to
some name). This one is better if we want to migrate to dbus, since dbus
already has this capability as well as sending the sockets inbound (at least it
seems so on unix) and we could get rid of the unix-domain socket completely.
-* Keep the unix-domain connections open forever. Boss can remember which socket
+* Keep the unix-domain connections open forever. Init can remember which socket
was sent to which connection and when the connection closes (because the
application crashed), it can drop all the references on the sockets. This
seems easier to implement.
@@ -75,12 +75,12 @@ There are two possibilities:
The commands
------------
* Command to release a socket. This one would have single parameter, the token
- used to get the socket. After this, boss would decrease its reference count
- and if it drops to zero, close its own copy of the socket. This should be used
- when the module stops using the socket (and after closes it). The
- library could remember the file-descriptor to token mapping (for
- common applications that don't request the same socket multiple
- times in parallel).
+ used to get the socket. After this, b10-init would decrease its reference
+ count and if it drops to zero, close its own copy of the socket. This
+ should be used when the module stops using the socket (and after closes
+ it). The library could remember the file-descriptor to token mapping (for
+ common applications that don't request the same socket multiple times in
+ parallel).
* Command to request a socket. It would have parameters to specify which socket
(IP address, address family, port) and how to allow sharing. Sharing would be
one of:
diff --git a/src/bin/bind10/init.py.in b/src/bin/bind10/init.py.in
new file mode 100755
index 0000000..874fb34
--- /dev/null
+++ b/src/bin/bind10/init.py.in
@@ -0,0 +1,1320 @@
+#!@PYTHON@
+
+# Copyright (C) 2010,2011 Internet Systems Consortium.
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
+# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+"""
+This file implements the b10-init program.
+
+Its purpose is to start up the BIND 10 system, and then manage the
+processes, by starting and stopping processes, plus restarting
+processes that exit.
+
+To start the system, it first runs the c-channel program (msgq), then
+connects to that. It then runs the configuration manager, and reads
+its own configuration. Then it proceeds to starting other modules.
+
+The Python subprocess module is used for starting processes, but
+because this is not efficient for managing groups of processes,
+SIGCHLD signals are caught and processed using the signal module.
+
+Most of the logic is contained in the Init class. However, since Python
+requires that signal processing happen in the main thread, we do
+signal handling outside of that class, in the code running for
+__main__.
+"""
+
+import sys; sys.path.append ('@@PYTHONPATH@@')
+import os
+
+# If B10_FROM_SOURCE is set in the environment, we use data files
+# from a directory relative to that, otherwise we use the ones
+# installed on the system
+if "B10_FROM_SOURCE" in os.environ:
+ SPECFILE_LOCATION = os.environ["B10_FROM_SOURCE"] +\
+ "/src/bin/bind10/init.spec"
+else:
+ PREFIX = "@prefix@"
+ DATAROOTDIR = "@datarootdir@"
+ SPECFILE_LOCATION = "@datadir@/@PACKAGE@/init.spec"\
+ .replace("${datarootdir}", DATAROOTDIR)\
+ .replace("${prefix}", PREFIX)
+
+import subprocess
+import signal
+import re
+import errno
+import time
+import select
+import random
+import socket
+from optparse import OptionParser, OptionValueError
+import io
+import pwd
+import posix
+import copy
+
+from bind10_config import LIBEXECPATH
+import bind10_config
+import isc.cc
+import isc.util.process
+import isc.net.parse
+import isc.log
+from isc.log_messages.init_messages import *
+import isc.bind10.component
+import isc.bind10.special_component
+import isc.bind10.socket_cache
+import libutil_io_python
+import tempfile
+
+isc.log.init("b10-init", buffer=True)
+logger = isc.log.Logger("init")
+
+# Pending system-wide debug level definitions, the ones we
+# use here are hardcoded for now
+DBG_PROCESS = logger.DBGLVL_TRACE_BASIC
+DBG_COMMANDS = logger.DBGLVL_TRACE_DETAIL
+
+# Messages sent over the unix domain socket to indicate if it is followed by a real socket
+CREATOR_SOCKET_OK = b"1\n"
+CREATOR_SOCKET_UNAVAILABLE = b"0\n"
+
+# RCodes of known exceptions for the get_token command
+CREATOR_SOCKET_ERROR = 2
+CREATOR_SHARE_ERROR = 3
+
+# Assign this process some longer name
+isc.util.process.rename()
+
+# This is the version that gets displayed to the user.
+# The VERSION string consists of the module name, the module version
+# number, and the overall BIND 10 version number (set in configure.ac).
+VERSION = "bind10 20110223 (BIND 10 @PACKAGE_VERSION@)"
+
+# This is for boot_time of Init
+_BASETIME = time.gmtime()
+
+# Detailed error message commonly used on startup failure, possibly due to
+# permission issue regarding log lock file. We dump verbose message because
+# it may not be clear exactly what to do if it simply says
+# "failed to open <filename>: permission denied"
+NOTE_ON_LOCK_FILE = """\
+TIP: if this is about permission error for a lock file, check if the directory
+of the file is writable for the user of the bind10 process; often you need
+to start bind10 as a super user. Also, if you specify the -u option to
+change the user and group, the directory must be writable for the group,
+and the created lock file must be writable for that user. Finally, make sure
+the lock file is not left in the directly before restarting.
+"""
+
+class ProcessInfoError(Exception): pass
+
+class ChangeUserError(Exception):
+ '''Exception raised when setuid/setgid fails.
+
+ When raised, it's expected to be propagated via underlying component
+ management modules to the top level so that it will help provide useful
+ fatal error message.
+
+ '''
+ pass
+
+class ProcessInfo:
+ """Information about a process"""
+
+ dev_null = open(os.devnull, "w")
+
+ def __init__(self, name, args, env={}, dev_null_stdout=False,
+ dev_null_stderr=False):
+ self.name = name
+ self.args = args
+ self.env = env
+ self.dev_null_stdout = dev_null_stdout
+ self.dev_null_stderr = dev_null_stderr
+ self.process = None
+ self.pid = None
+
+ def _preexec_work(self):
+ """Function used before running a program that needs to run as a
+ different user."""
+ # First, put us into a separate process group so we don't get
+ # SIGINT signals on Ctrl-C (b10-init will shut everthing down by
+ # other means).
+ os.setpgrp()
+
+ def _spawn(self):
+ if self.dev_null_stdout:
+ spawn_stdout = self.dev_null
+ else:
+ spawn_stdout = None
+ if self.dev_null_stderr:
+ spawn_stderr = self.dev_null
+ else:
+ spawn_stderr = None
+ # Environment variables for the child process will be a copy of those
+ # of the b10-init process with any additional specific variables given
+ # on construction (self.env).
+ spawn_env = copy.deepcopy(os.environ)
+ spawn_env.update(self.env)
+ spawn_env['PATH'] = LIBEXECPATH + ':' + spawn_env['PATH']
+ self.process = subprocess.Popen(self.args,
+ stdin=subprocess.PIPE,
+ stdout=spawn_stdout,
+ stderr=spawn_stderr,
+ close_fds=True,
+ env=spawn_env,
+ preexec_fn=self._preexec_work)
+ self.pid = self.process.pid
+
+ # spawn() and respawn() are the same for now, but in the future they
+ # may have different functionality
+ def spawn(self):
+ self._spawn()
+
+ def respawn(self):
+ self._spawn()
+
+class CChannelConnectError(Exception): pass
+
+class ProcessStartError(Exception): pass
+
+class Init:
+ """Init of BIND class."""
+
+ def __init__(self, msgq_socket_file=None, data_path=None,
+ config_filename=None, clear_config=False,
+ verbose=False, nokill=False, setuid=None, setgid=None,
+ username=None, cmdctl_port=None, wait_time=10):
+ """
+ Initialize the Init of BIND. This is a singleton (only one can run).
+
+ The msgq_socket_file specifies the UNIX domain socket file that the
+ msgq process listens on. If verbose is True, then b10-init reports
+ what it is doing.
+
+ Data path and config filename are passed through to config manager
+ (if provided) and specify the config file to be used.
+
+ The cmdctl_port is passed to cmdctl and specify on which port it
+ should listen.
+
+ wait_time controls the amount of time (in seconds) that Init waits
+ for selected processes to initialize before continuing with the
+ initialization. Currently this is only the configuration manager.
+ """
+ self.cc_session = None
+ self.ccs = None
+ self.curproc = None
+ self.msgq_socket_file = msgq_socket_file
+ self.component_config = {}
+ # Some time in future, it may happen that a single component has
+ # multple processes (like a pipeline-like component). If so happens,
+ # name "components" may be inapropriate. But as the code isn't probably
+ # completely ready for it, we leave it at components for now. We also
+ # want to support multiple instances of a single component. If it turns
+ # out that we'll have a single component with multiple same processes
+ # or if we start multiple components with the same configuration (we do
+ # this now, but it might change) is an open question.
+ self.components = {}
+ # Simply list of components that died and need to wait for a
+ # restart. Components manage their own restart schedule now
+ self.components_to_restart = []
+ self.runnable = False
+ self.__uid = setuid
+ self.__gid = setgid
+ self.username = username
+ self.verbose = verbose
+ self.nokill = nokill
+ self.data_path = data_path
+ self.config_filename = config_filename
+ self.clear_config = clear_config
+ self.cmdctl_port = cmdctl_port
+ self.wait_time = wait_time
+ self.msgq_timeout = 5
+
+ # _run_under_unittests is only meant to be used when testing. It
+ # bypasses execution of some code to help with testing.
+ self._run_under_unittests = False
+
+ self._component_configurator = isc.bind10.component.Configurator(self,
+ isc.bind10.special_component.get_specials())
+ # The priorities here make them start in the correct order. First
+ # the socket creator (which would drop root privileges by then),
+ # then message queue and after that the config manager (which uses
+ # the config manager)
+ self.__core_components = {
+ 'sockcreator': {
+ 'kind': 'core',
+ 'special': 'sockcreator',
+ 'priority': 200
+ },
+ 'msgq': {
+ 'kind': 'core',
+ 'special': 'msgq',
+ 'priority': 199
+ },
+ 'cfgmgr': {
+ 'kind': 'core',
+ 'special': 'cfgmgr',
+ 'priority': 198
+ }
+ }
+ self.__started = False
+ self.exitcode = 0
+
+ # If -v was set, enable full debug logging.
+ if self.verbose:
+ logger.set_severity("DEBUG", 99)
+ # This is set in init_socket_srv
+ self._socket_path = None
+ self._socket_cache = None
+ self._tmpdir = None
+ self._srv_socket = None
+ self._unix_sockets = {}
+
+ def __propagate_component_config(self, config):
+ comps = dict(config)
+ # Fill in the core components, so they stay alive
+ for comp in self.__core_components:
+ if comp in comps:
+ raise Exception(comp + " is core component managed by " +
+ "b10-init, do not set it")
+ comps[comp] = self.__core_components[comp]
+ # Update the configuration
+ self._component_configurator.reconfigure(comps)
+
+ def change_user(self):
+ '''Change the user and group to those specified on construction.
+
+ This method is expected to be called by a component on initial
+ startup when the system is ready to switch the user and group
+ (i.e., once all components that need the privilege of the original
+ user have started).
+ '''
+ try:
+ if self.__gid is not None:
+ logger.info(BIND10_SETGID, self.__gid)
+ posix.setgid(self.__gid)
+ except Exception as ex:
+ raise ChangeUserError('failed to change group: ' + str(ex))
+
+ try:
+ if self.__uid is not None:
+ posix.setuid(self.__uid)
+ # We use one-shot logger after setuid here. This will
+ # detect any permission issue regarding logging due to the
+ # result of setuid at the earliest opportunity.
+ isc.log.Logger("b10-init").info(BIND10_SETUID, self.__uid)
+ except Exception as ex:
+ raise ChangeUserError('failed to change user: ' + str(ex))
+
+ def config_handler(self, new_config):
+ # If this is initial update, don't do anything now, leave it to startup
+ if not self.runnable:
+ return
+ logger.debug(DBG_COMMANDS, BIND10_RECEIVED_NEW_CONFIGURATION,
+ new_config)
+ try:
+ if 'components' in new_config:
+ self.__propagate_component_config(new_config['components'])
+ return isc.config.ccsession.create_answer(0)
+ except Exception as e:
+ return isc.config.ccsession.create_answer(1, str(e))
+
+ def get_processes(self):
+ pids = list(self.components.keys())
+ pids.sort()
+ process_list = [ ]
+ for pid in pids:
+ process_list.append([pid, self.components[pid].name(),
+ self.components[pid].address()])
+ return process_list
+
+ def _get_stats_data(self):
+ return { 'boot_time':
+ time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
+ }
+
+ def command_handler(self, command, args):
+ logger.debug(DBG_COMMANDS, BIND10_RECEIVED_COMMAND, command)
+ answer = isc.config.ccsession.create_answer(1, "command not implemented")
+ if type(command) != str:
+ answer = isc.config.ccsession.create_answer(1, "bad command")
+ else:
+ if command == "shutdown":
+ self.runnable = False
+ answer = isc.config.ccsession.create_answer(0)
+ elif command == "getstats":
+ answer = isc.config.ccsession.create_answer(
+ 0, self._get_stats_data())
+ elif command == "ping":
+ answer = isc.config.ccsession.create_answer(0, "pong")
+ elif command == "show_processes":
+ answer = isc.config.ccsession. \
+ create_answer(0, self.get_processes())
+ elif command == "get_socket":
+ answer = self._get_socket(args)
+ elif command == "drop_socket":
+ if "token" not in args:
+ answer = isc.config.ccsession. \
+ create_answer(1, "Missing token parameter")
+ else:
+ try:
+ self._socket_cache.drop_socket(args["token"])
+ answer = isc.config.ccsession.create_answer(0)
+ except Exception as e:
+ answer = isc.config.ccsession.create_answer(1, str(e))
+ else:
+ answer = isc.config.ccsession.create_answer(1,
+ "Unknown command")
+ return answer
+
+ def kill_started_components(self):
+ """
+ Called as part of the exception handling when a process fails to
+ start, this runs through the list of started processes, killing
+ each one. It then clears that list.
+ """
+ logger.info(BIND10_KILLING_ALL_PROCESSES)
+ self.__kill_children(True)
+ self.components = {}
+
+ def _read_bind10_config(self):
+ """
+ Reads the parameters associated with the Init module itself.
+
+ This means the list of components we should start now.
+
+ This could easily be combined into start_all_processes, but
+ it stays because of historical reasons and because the tests
+ replace the method sometimes.
+ """
+ logger.info(BIND10_READING_INIT_CONFIGURATION)
+
+ config_data = self.ccs.get_full_config()
+ self.__propagate_component_config(config_data['components'])
+
+ def log_starting(self, process, port = None, address = None):
+ """
+ A convenience function to output a "Starting xxx" message if the
+ logging is set to DEBUG with debuglevel DBG_PROCESS or higher.
+ Putting this into a separate method ensures
+ that the output form is consistent across all processes.
+
+ The process name (passed as the first argument) is put into
+ self.curproc, and is used to indicate which process failed to
+ start if there is an error (and is used in the "Started" message
+ on success). The optional port and address information are
+ appended to the message (if present).
+ """
+ self.curproc = process
+ if port is None and address is None:
+ logger.info(BIND10_STARTING_PROCESS, self.curproc)
+ elif address is None:
+ logger.info(BIND10_STARTING_PROCESS_PORT, self.curproc,
+ port)
+ else:
+ logger.info(BIND10_STARTING_PROCESS_PORT_ADDRESS,
+ self.curproc, address, port)
+
+ def log_started(self, pid = None):
+ """
+ A convenience function to output a 'Started xxxx (PID yyyy)'
+ message. As with starting_message(), this ensures a consistent
+ format.
+ """
+ if pid is None:
+ logger.debug(DBG_PROCESS, BIND10_STARTED_PROCESS, self.curproc)
+ else:
+ logger.debug(DBG_PROCESS, BIND10_STARTED_PROCESS_PID, self.curproc, pid)
+
+ def process_running(self, msg, who):
+ """
+ Some processes return a message to the Init after they have
+ started to indicate that they are running. The form of the
+ message is a dictionary with contents {"running:", "<process>"}.
+ This method checks the passed message and returns True if the
+ "who" process is contained in the message (so is presumably
+ running). It returns False for all other conditions and will
+ log an error if appropriate.
+ """
+ if msg is not None:
+ try:
+ if msg["running"] == who:
+ return True
+ else:
+ logger.error(BIND10_STARTUP_UNEXPECTED_MESSAGE, msg)
+ except:
+ logger.error(BIND10_STARTUP_UNRECOGNISED_MESSAGE, msg)
+
+ return False
+
+ # The next few methods start the individual processes of BIND-10. They
+ # are called via start_all_processes(). If any fail, an exception is
+ # raised which is caught by the caller of start_all_processes(); this kills
+ # processes started up to that point before terminating the program.
+
+ def _make_process_info(self, name, args, env,
+ dev_null_stdout=False, dev_null_stderr=False):
+ """
+ Wrapper around ProcessInfo(), useful to override
+ ProcessInfo() creation during testing.
+ """
+ return ProcessInfo(name, args, env, dev_null_stdout, dev_null_stderr)
+
+ def start_msgq(self):
+ """
+ Start the message queue and connect to the command channel.
+ """
+ self.log_starting("b10-msgq")
+ msgq_proc = self._make_process_info("b10-msgq", ["b10-msgq"],
+ self.c_channel_env,
+ True, not self.verbose)
+ msgq_proc.spawn()
+ self.log_started(msgq_proc.pid)
+
+ # Now connect to the c-channel
+ cc_connect_start = time.time()
+ while self.cc_session is None:
+ # if we are run under unittests, break
+ if self._run_under_unittests:
+ break
+
+ # if we have been trying for "a while" give up
+ if (time.time() - cc_connect_start) > self.msgq_timeout:
+ if msgq_proc.process:
+ msgq_proc.process.kill()
+ logger.error(BIND10_CONNECTING_TO_CC_FAIL)
+ raise CChannelConnectError("Unable to connect to c-channel after 5 seconds")
+
+ # try to connect, and if we can't wait a short while
+ try:
+ self.cc_session = isc.cc.Session(self.msgq_socket_file)
+ except isc.cc.session.SessionError:
+ time.sleep(0.1)
+
+ # Subscribe to the message queue. The only messages we expect to receive
+ # on this channel are once relating to process startup.
+ if self.cc_session is not None:
+ self.cc_session.group_subscribe("Init")
+
+ return msgq_proc
+
+ def start_cfgmgr(self):
+ """
+ Starts the configuration manager process
+ """
+ self.log_starting("b10-cfgmgr")
+ args = ["b10-cfgmgr"]
+ if self.data_path is not None:
+ args.append("--data-path=" + self.data_path)
+ if self.config_filename is not None:
+ args.append("--config-filename=" + self.config_filename)
+ if self.clear_config:
+ args.append("--clear-config")
+ bind_cfgd = self._make_process_info("b10-cfgmgr", args,
+ self.c_channel_env)
+ bind_cfgd.spawn()
+ self.log_started(bind_cfgd.pid)
+
+ # Wait for the configuration manager to start up as
+ # subsequent initialization cannot proceed without it. The
+ # time to wait can be set on the command line.
+ time_remaining = self.wait_time
+ msg, env = self.cc_session.group_recvmsg()
+ while time_remaining > 0 and not self.process_running(msg, "ConfigManager"):
+ logger.debug(DBG_PROCESS, BIND10_WAIT_CFGMGR)
+ time.sleep(1)
+ time_remaining = time_remaining - 1
+ msg, env = self.cc_session.group_recvmsg()
+
+ if not self.process_running(msg, "ConfigManager"):
+ raise ProcessStartError("Configuration manager process has not started")
+
+ return bind_cfgd
+
+ def start_ccsession(self, c_channel_env):
+ """
+ Start the CC Session
+
+ The argument c_channel_env is unused but is supplied to keep the
+ argument list the same for all start_xxx methods.
+
+ With regards to logging, note that as the CC session is not a
+ process, the log_starting/log_started methods are not used.
+ """
+ logger.info(BIND10_STARTING_CC)
+ self.ccs = isc.config.ModuleCCSession(SPECFILE_LOCATION,
+ self.config_handler,
+ self.command_handler,
+ socket_file = self.msgq_socket_file)
+ self.ccs.start()
+ logger.debug(DBG_PROCESS, BIND10_STARTED_CC)
+
+ # A couple of utility methods for starting processes...
+
+ def start_process(self, name, args, c_channel_env, port=None, address=None):
+ """
+ Given a set of command arguments, start the process and output
+ appropriate log messages. If the start is successful, the process
+ is added to the list of started processes.
+
+ The port and address arguments are for log messages only.
+ """
+ self.log_starting(name, port, address)
+ newproc = self._make_process_info(name, args, c_channel_env)
+ newproc.spawn()
+ self.log_started(newproc.pid)
+ return newproc
+
+ def register_process(self, pid, component):
+ """
+ Put another process into b10-init to watch over it. When the process
+ dies, the component.failed() is called with the exit code.
+
+ It is expected the info is a isc.bind10.component.BaseComponent
+ subclass (or anything having the same interface).
+ """
+ self.components[pid] = component
+
+ def start_simple(self, name):
+ """
+ Most of the BIND-10 processes are started with the command:
+
+ <process-name> [-v]
+
+ ... where -v is appended if verbose is enabled. This method
+ generates the arguments from the name and starts the process.
+
+ The port and address arguments are for log messages only.
+ """
+ # Set up the command arguments.
+ args = [name]
+ if self.verbose:
+ args += ['-v']
+
+ # ... and start the process
+ return self.start_process(name, args, self.c_channel_env)
+
+ # The next few methods start up the rest of the BIND-10 processes.
+ # Although many of these methods are little more than a call to
+ # start_simple, they are retained (a) for testing reasons and (b) as a place
+ # where modifications can be made if the process start-up sequence changes
+ # for a given process.
+
+ def start_auth(self):
+ """
+ Start the Authoritative server
+ """
+ authargs = ['b10-auth']
+ if self.verbose:
+ authargs += ['-v']
+
+ # ... and start
+ return self.start_process("b10-auth", authargs, self.c_channel_env)
+
+ def start_resolver(self):
+ """
+ Start the Resolver. At present, all these arguments and switches
+ are pure speculation. As with the auth daemon, they should be
+ read from the configuration database.
+ """
+ self.curproc = "b10-resolver"
+ # XXX: this must be read from the configuration manager in the future
+ resargs = ['b10-resolver']
+ if self.verbose:
+ resargs += ['-v']
+
+ # ... and start
+ return self.start_process("b10-resolver", resargs, self.c_channel_env)
+
+ def start_cmdctl(self):
+ """
+ Starts the command control process
+ """
+ args = ["b10-cmdctl"]
+ if self.cmdctl_port is not None:
+ args.append("--port=" + str(self.cmdctl_port))
+ if self.verbose:
+ args.append("-v")
+ return self.start_process("b10-cmdctl", args, self.c_channel_env,
+ self.cmdctl_port)
+
+ def start_all_components(self):
+ """
+ Starts up all the components. Any exception generated during the
+ starting of the components is handled by the caller.
+ """
+ # Start the real core (sockcreator, msgq, cfgmgr)
+ self._component_configurator.startup(self.__core_components)
+
+ # Connect to the msgq. This is not a process, so it's not handled
+ # inside the configurator.
+ self.start_ccsession(self.c_channel_env)
+
+ # Extract the parameters associated with Init. This can only be
+ # done after the CC Session is started. Note that the logging
+ # configuration may override the "-v" switch set on the command line.
+ self._read_bind10_config()
+
+ # TODO: Return the dropping of privileges
+
+ def startup(self):
+ """
+ Start the Init instance.
+
+ Returns None if successful, otherwise an string describing the
+ problem.
+ """
+ # Try to connect to the c-channel daemon, to see if it is already
+ # running
+ c_channel_env = {}
+ if self.msgq_socket_file is not None:
+ c_channel_env["BIND10_MSGQ_SOCKET_FILE"] = self.msgq_socket_file
+ logger.debug(DBG_PROCESS, BIND10_CHECK_MSGQ_ALREADY_RUNNING)
+ try:
+ self.cc_session = isc.cc.Session(self.msgq_socket_file)
+ logger.fatal(BIND10_MSGQ_ALREADY_RUNNING)
+ return "b10-msgq already running, or socket file not cleaned , cannot start"
+ except isc.cc.session.SessionError:
+ # this is the case we want, where the msgq is not running
+ pass
+
+ # Start all components. If any one fails to start, kill all started
+ # components and exit with an error indication.
+ try:
+ self.c_channel_env = c_channel_env
+ self.start_all_components()
+ except ChangeUserError as e:
+ self.kill_started_components()
+ return str(e) + '; ' + NOTE_ON_LOCK_FILE.replace('\n', ' ')
+ except Exception as e:
+ self.kill_started_components()
+ return "Unable to start " + self.curproc + ": " + str(e)
+
+ # Started successfully
+ self.runnable = True
+ self.__started = True
+ return None
+
+ def stop_process(self, process, recipient, pid):
+ """
+ Stop the given process, friendly-like. The process is the name it has
+ (in logs, etc), the recipient is the address on msgq. The pid is the
+ pid of the process (if we have multiple processes of the same name,
+ it might want to choose if it is for this one).
+ """
+ logger.info(BIND10_STOP_PROCESS, process)
+ self.cc_session.group_sendmsg(isc.config.ccsession.
+ create_command('shutdown', {'pid': pid}),
+ recipient, recipient)
+
+ def component_shutdown(self, exitcode=0):
+ """
+ Stop the Init instance from a components' request. The exitcode
+ indicates the desired exit code.
+
+ If we did not start yet, it raises an exception, which is meant
+ to propagate through the component and configurator to the startup
+ routine and abort the startup immediately. If it is started up already,
+ we just mark it so we terminate soon.
+
+ It does set the exit code in both cases.
+ """
+ self.exitcode = exitcode
+ if not self.__started:
+ raise Exception("Component failed during startup");
+ else:
+ self.runnable = False
+
+ def shutdown(self):
+ """Stop the Init instance."""
+ logger.info(BIND10_SHUTDOWN)
+ # If ccsession is still there, inform rest of the system this module
+ # is stopping. Since everything will be stopped shortly, this is not
+ # really necessary, but this is done to reflect that b10-init is also
+ # 'just' a module.
+ self.ccs.send_stopping()
+
+ # try using the BIND 10 request to stop
+ try:
+ self._component_configurator.shutdown()
+ except:
+ pass
+ # XXX: some delay probably useful... how much is uncertain
+ # I have changed the delay from 0.5 to 1, but sometime it's
+ # still not enough.
+ time.sleep(1)
+ self.reap_children()
+
+ # Send TERM and KILL signals to modules if we're not prevented
+ # from doing so
+ if not self.nokill:
+ # next try sending a SIGTERM
+ self.__kill_children(False)
+ # finally, send SIGKILL (unmaskable termination) until everybody
+ # dies
+ while self.components:
+ # XXX: some delay probably useful... how much is uncertain
+ time.sleep(0.1)
+ self.reap_children()
+ self.__kill_children(True)
+ logger.info(BIND10_SHUTDOWN_COMPLETE)
+
+ def __kill_children(self, forceful):
+ '''Terminate remaining subprocesses by sending a signal.
+
+ The forceful paramter will be passed Component.kill().
+ This is a dedicated subroutine of shutdown(), just to unify two
+ similar cases.
+
+ '''
+ logmsg = BIND10_SEND_SIGKILL if forceful else BIND10_SEND_SIGTERM
+ # We need to make a copy of values as the components may be modified
+ # in the loop.
+ for component in list(self.components.values()):
+ logger.info(logmsg, component.name(), component.pid())
+ try:
+ component.kill(forceful)
+ except OSError as ex:
+ # If kill() failed due to EPERM, it doesn't make sense to
+ # keep trying, so we just log the fact and forget that
+ # component. Ignore other OSErrors (usually ESRCH because
+ # the child finally exited)
+ signame = "SIGKILL" if forceful else "SIGTERM"
+ logger.info(BIND10_SEND_SIGNAL_FAIL, signame,
+ component.name(), component.pid(), ex)
+ if ex.errno == errno.EPERM:
+ del self.components[component.pid()]
+
+ def _get_process_exit_status(self):
+ return os.waitpid(-1, os.WNOHANG)
+
+ def reap_children(self):
+ """Check to see if any of our child processes have exited,
+ and note this for later handling.
+ """
+ while True:
+ try:
+ (pid, exit_status) = self._get_process_exit_status()
+ except OSError as o:
+ if o.errno == errno.ECHILD:
+ break
+ # XXX: should be impossible to get any other error here
+ raise
+ if pid == 0:
+ break
+ if pid in self.components:
+ # One of the components we know about. Get information on it.
+ component = self.components.pop(pid)
+ logger.info(BIND10_PROCESS_ENDED, component.name(), pid,
+ exit_status)
+ if component.is_running() and self.runnable:
+ # Tell it it failed. But only if it matters (we are
+ # not shutting down and the component considers itself
+ # to be running.
+ component_restarted = component.failed(exit_status);
+ # if the process wants to be restarted, but not just yet,
+ # it returns False
+ if not component_restarted:
+ self.components_to_restart.append(component)
+ else:
+ logger.info(BIND10_UNKNOWN_CHILD_PROCESS_ENDED, pid)
+
+ def restart_processes(self):
+ """
+ Restart any dead processes:
+
+ * Returns the time when the next process is ready to be restarted.
+ * If the server is shutting down, returns 0.
+ * If there are no processes, returns None.
+
+ The values returned can be safely passed into select() as the
+ timeout value.
+
+ """
+ if not self.runnable:
+ return 0
+ still_dead = []
+ # keep track of the first time we need to check this queue again,
+ # if at all
+ next_restart_time = None
+ now = time.time()
+ for component in self.components_to_restart:
+ # If the component was removed from the configurator between since
+ # scheduled to restart, just ignore it. The object will just be
+ # dropped here.
+ if not self._component_configurator.has_component(component):
+ logger.info(BIND10_RESTART_COMPONENT_SKIPPED, component.name())
+ elif not component.restart(now):
+ still_dead.append(component)
+ if next_restart_time is None or\
+ next_restart_time > component.get_restart_time():
+ next_restart_time = component.get_restart_time()
+ self.components_to_restart = still_dead
+
+ return next_restart_time
+
+ def _get_socket(self, args):
+ """
+ Implementation of the get_socket CC command. It asks the cache
+ to provide the token and sends the information back.
+ """
+ try:
+ try:
+ addr = isc.net.parse.addr_parse(args['address'])
+ port = isc.net.parse.port_parse(args['port'])
+ protocol = args['protocol']
+ if protocol not in ['UDP', 'TCP']:
+ raise ValueError("Protocol must be either UDP or TCP")
+ share_mode = args['share_mode']
+ if share_mode not in ['ANY', 'SAMEAPP', 'NO']:
+ raise ValueError("Share mode must be one of ANY, SAMEAPP" +
+ " or NO")
+ share_name = args['share_name']
+ except KeyError as ke:
+ return \
+ isc.config.ccsession.create_answer(1,
+ "Missing parameter " +
+ str(ke))
+
+ # FIXME: This call contains blocking IPC. It is expected to be
+ # short, but if it turns out to be problem, we'll need to do
+ # something about it.
+ token = self._socket_cache.get_token(protocol, addr, port,
+ share_mode, share_name)
+ return isc.config.ccsession.create_answer(0, {
+ 'token': token,
+ 'path': self._socket_path
+ })
+ except isc.bind10.socket_cache.SocketError as e:
+ return isc.config.ccsession.create_answer(CREATOR_SOCKET_ERROR,
+ str(e))
+ except isc.bind10.socket_cache.ShareError as e:
+ return isc.config.ccsession.create_answer(CREATOR_SHARE_ERROR,
+ str(e))
+ except Exception as e:
+ return isc.config.ccsession.create_answer(1, str(e))
+
+ def socket_request_handler(self, token, unix_socket):
+ """
+ This function handles a token that comes over a unix_domain socket.
+ The function looks into the _socket_cache and sends the socket
+ identified by the token back over the unix_socket.
+ """
+ try:
+ token = str(token, 'ASCII') # Convert from bytes to str
+ fd = self._socket_cache.get_socket(token, unix_socket.fileno())
+ # FIXME: These two calls are blocking in their nature. An OS-level
+ # buffer is likely to be large enough to hold all these data, but
+ # if it wasn't and the remote application got stuck, we would have
+ # a problem. If there appear such problems, we should do something
+ # about it.
+ unix_socket.sendall(CREATOR_SOCKET_OK)
+ libutil_io_python.send_fd(unix_socket.fileno(), fd)
+ except Exception as e:
+ logger.info(BIND10_NO_SOCKET, token, e)
+ unix_socket.sendall(CREATOR_SOCKET_UNAVAILABLE)
+
+ def socket_consumer_dead(self, unix_socket):
+ """
+ This function handles when a unix_socket closes. This means all
+ sockets sent to it are to be considered closed. This function signals
+ so to the _socket_cache.
+ """
+ logger.info(BIND10_LOST_SOCKET_CONSUMER, unix_socket.fileno())
+ try:
+ self._socket_cache.drop_application(unix_socket.fileno())
+ except ValueError:
+ # This means the application holds no sockets. It's harmless, as it
+ # can happen in real life - for example, it requests a socket, but
+ # get_socket doesn't find it, so the application dies. It should be
+ # rare, though.
+ pass
+
+ def set_creator(self, creator):
+ """
+ Registeres a socket creator into the b10-init. The socket creator is not
+ used directly, but through a cache. The cache is created in this
+ method.
+
+ If called more than once, it raises a ValueError.
+ """
+ if self._socket_cache is not None:
+ raise ValueError("A creator was inserted previously")
+ self._socket_cache = isc.bind10.socket_cache.Cache(creator)
+
+ def init_socket_srv(self):
+ """
+ Creates and listens on a unix-domain socket to be able to send out
+ the sockets.
+
+ This method should be called after switching user, or the switched
+ applications won't be able to access the socket.
+ """
+ self._srv_socket = socket.socket(socket.AF_UNIX)
+ # We create a temporary directory somewhere safe and unique, to avoid
+ # the need to find the place ourself or bother users. Also, this
+ # secures the socket on some platforms, as it creates a private
+ # directory.
+ self._tmpdir = tempfile.mkdtemp(prefix='sockcreator-')
+ # Get the name
+ self._socket_path = os.path.join(self._tmpdir, "sockcreator")
+ # And bind the socket to the name
+ self._srv_socket.bind(self._socket_path)
+ self._srv_socket.listen(5)
+
+ def remove_socket_srv(self):
+ """
+ Closes and removes the listening socket and the directory where it
+ lives, as we created both.
+
+ It does nothing if the _srv_socket is not set (eg. it was not yet
+ initialized).
+ """
+ if self._srv_socket is not None:
+ self._srv_socket.close()
+ if os.path.exists(self._socket_path):
+ os.remove(self._socket_path)
+ if os.path.isdir(self._tmpdir):
+ os.rmdir(self._tmpdir)
+
+ def _srv_accept(self):
+ """
+ Accept a socket from the unix domain socket server and put it to the
+ others we care about.
+ """
+ (socket, conn) = self._srv_socket.accept()
+ self._unix_sockets[socket.fileno()] = (socket, b'')
+
+ def _socket_data(self, socket_fileno):
+ """
+ This is called when a socket identified by the socket_fileno needs
+ attention. We try to read data from there. If it is closed, we remove
+ it.
+ """
+ (sock, previous) = self._unix_sockets[socket_fileno]
+ while True:
+ try:
+ data = sock.recv(1, socket.MSG_DONTWAIT)
+ except socket.error as se:
+ # These two might be different on some systems
+ if se.errno == errno.EAGAIN or se.errno == errno.EWOULDBLOCK:
+ # No more data now. Oh, well, just store what we have.
+ self._unix_sockets[socket_fileno] = (sock, previous)
+ return
+ else:
+ data = b'' # Pretend it got closed
+ if len(data) == 0: # The socket got to it's end
+ del self._unix_sockets[socket_fileno]
+ self.socket_consumer_dead(sock)
+ sock.close()
+ return
+ else:
+ if data == b"\n":
+ # Handle this token and clear it
+ self.socket_request_handler(previous, sock)
+ previous = b''
+ else:
+ previous += data
+
+ def run(self, wakeup_fd):
+ """
+ The main loop, waiting for sockets, commands and dead processes.
+ Runs as long as the runnable is true.
+
+ The wakeup_fd descriptor is the read end of pipe where CHLD signal
+ handler writes.
+ """
+ ccs_fd = self.ccs.get_socket().fileno()
+ while self.runnable:
+ # clean up any processes that exited
+ self.reap_children()
+ next_restart = self.restart_processes()
+ if next_restart is None:
+ wait_time = None
+ else:
+ wait_time = max(next_restart - time.time(), 0)
+
+ # select() can raise EINTR when a signal arrives,
+ # even if they are resumable, so we have to catch
+ # the exception
+ try:
+ (rlist, wlist, xlist) = \
+ select.select([wakeup_fd, ccs_fd,
+ self._srv_socket.fileno()] +
+ list(self._unix_sockets.keys()), [], [],
+ wait_time)
+ except select.error as err:
+ if err.args[0] == errno.EINTR:
+ (rlist, wlist, xlist) = ([], [], [])
+ else:
+ logger.fatal(BIND10_SELECT_ERROR, err)
+ break
+
+ for fd in rlist + xlist:
+ if fd == ccs_fd:
+ try:
+ self.ccs.check_command()
+ except isc.cc.session.ProtocolError:
+ logger.fatal(BIND10_MSGQ_DISAPPEARED)
+ self.runnable = False
+ break
+ elif fd == wakeup_fd:
+ os.read(wakeup_fd, 32)
+ elif fd == self._srv_socket.fileno():
+ self._srv_accept()
+ elif fd in self._unix_sockets:
+ self._socket_data(fd)
+
+# global variables, needed for signal handlers
+options = None
+b10_init = None
+
+def reaper(signal_number, stack_frame):
+ """A child process has died (SIGCHLD received)."""
+ # don't do anything...
+ # the Python signal handler has been set up to write
+ # down a pipe, waking up our select() bit
+ pass
+
+def get_signame(signal_number):
+ """Return the symbolic name for a signal."""
+ for sig in dir(signal):
+ if sig.startswith("SIG") and sig[3].isalnum():
+ if getattr(signal, sig) == signal_number:
+ return sig
+ return "Unknown signal %d" % signal_number
+
+# XXX: perhaps register atexit() function and invoke that instead
+def fatal_signal(signal_number, stack_frame):
+ """We need to exit (SIGINT or SIGTERM received)."""
+ global options
+ global b10_init
+ logger.info(BIND10_RECEIVED_SIGNAL, get_signame(signal_number))
+ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+ b10_init.runnable = False
+
+def process_rename(option, opt_str, value, parser):
+ """Function that renames the process if it is requested by a option."""
+ isc.util.process.rename(value)
+
+def parse_args(args=sys.argv[1:], Parser=OptionParser):
+ """
+ Function for parsing command line arguments. Returns the
+ options object from OptionParser.
+ """
+ parser = Parser(version=VERSION)
+ parser.add_option("-m", "--msgq-socket-file", dest="msgq_socket_file",
+ type="string", default=None,
+ help="UNIX domain socket file the b10-msgq daemon will use")
+ parser.add_option("-i", "--no-kill", action="store_true", dest="nokill",
+ default=False, help="do not send SIGTERM and SIGKILL signals to modules during shutdown")
+ parser.add_option("-u", "--user", dest="user", type="string", default=None,
+ help="Change user after startup (must run as root)")
+ parser.add_option("-v", "--verbose", dest="verbose", action="store_true",
+ help="display more about what is going on")
+ parser.add_option("--pretty-name", type="string", action="callback",
+ callback=process_rename,
+ help="Set the process name (displayed in ps, top, ...)")
+ parser.add_option("-c", "--config-file", action="store",
+ dest="config_file", default=None,
+ help="Configuration database filename")
+ parser.add_option("--clear-config", action="store_true",
+ dest="clear_config", default=False,
+ help="Create backup of the configuration file and " +
+ "start with a clean configuration")
+ parser.add_option("-p", "--data-path", dest="data_path",
+ help="Directory to search for configuration files",
+ default=None)
+ parser.add_option("--cmdctl-port", dest="cmdctl_port", type="int",
+ default=None, help="Port of command control")
+ parser.add_option("--pid-file", dest="pid_file", type="string",
+ default=None,
+ help="file to dump the PID of the BIND 10 process")
+ parser.add_option("-w", "--wait", dest="wait_time", type="int",
+ default=10, help="Time (in seconds) to wait for config manager to start up")
+
+ (options, args) = parser.parse_args(args)
+
+ if options.cmdctl_port is not None:
+ try:
+ isc.net.parse.port_parse(options.cmdctl_port)
+ except ValueError as e:
+ parser.error(e)
+
+ if args:
+ parser.print_help()
+ sys.exit(1)
+
+ return options
+
+def dump_pid(pid_file):
+ """
+ Dump the PID of the current process to the specified file. If the given
+ file is None this function does nothing. If the file already exists,
+ the existing content will be removed. If a system error happens in
+ creating or writing to the file, the corresponding exception will be
+ propagated to the caller.
+ """
+ if pid_file is None:
+ return
+ f = open(pid_file, "w")
+ f.write('%d\n' % os.getpid())
+ f.close()
+
+def unlink_pid_file(pid_file):
+ """
+ Remove the given file, which is basically expected to be the PID file
+ created by dump_pid(). The specified may or may not exist; if it
+ doesn't this function does nothing. Other system level errors in removing
+ the file will be propagated as the corresponding exception.
+ """
+ if pid_file is None:
+ return
+ try:
+ os.unlink(pid_file)
+ except OSError as error:
+ if error.errno is not errno.ENOENT:
+ raise
+
+def remove_lock_files():
+ """
+ Remove various lock files which were created by code such as in the
+ logger. This function should be called after BIND 10 shutdown.
+ """
+
+ lockfiles = ["logger_lockfile"]
+
+ lpath = bind10_config.DATA_PATH
+ if "B10_FROM_BUILD" in os.environ:
+ lpath = os.environ["B10_FROM_BUILD"]
+ if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
+ lpath = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"]
+ if "B10_LOCKFILE_DIR_FROM_BUILD" in os.environ:
+ lpath = os.environ["B10_LOCKFILE_DIR_FROM_BUILD"]
+
+ for f in lockfiles:
+ fname = lpath + '/' + f
+ if os.path.isfile(fname):
+ try:
+ os.unlink(fname)
+ except OSError as e:
+ # We catch and ignore permission related error on unlink.
+ # This can happen if bind10 started with -u, created a lock
+ # file as a privileged user, but the directory is not writable
+ # for the changed user. This setup will cause immediate
+ # start failure, and we leave verbose error message including
+ # the leftover lock file, so it should be acceptable to ignore
+ # it (note that it doesn't make sense to log this event at
+ # this poitn)
+ if e.errno != errno.EPERM and e.errno != errno.EACCES:
+ raise
+
+ return
+
+def main():
+ global options
+ global b10_init
+ # Enforce line buffering on stdout, even when not a TTY
+ sys.stdout = io.TextIOWrapper(sys.stdout.detach(), line_buffering=True)
+
+ options = parse_args()
+
+ # Announce startup. Making this is the first log message.
+ try:
+ logger.info(BIND10_STARTING, VERSION)
+ except RuntimeError as e:
+ sys.stderr.write('ERROR: failed to write the initial log: %s\n' %
+ str(e))
+ sys.stderr.write(NOTE_ON_LOCK_FILE)
+ sys.exit(1)
+
+ # Check user ID.
+ setuid = None
+ setgid = None
+ username = None
+ if options.user:
+ # Try getting information about the user, assuming UID passed.
+ try:
+ pw_ent = pwd.getpwuid(int(options.user))
+ setuid = pw_ent.pw_uid
+ setgid = pw_ent.pw_gid
+ username = pw_ent.pw_name
+ except ValueError:
+ pass
+ except KeyError:
+ pass
+
+ # Next try getting information about the user, assuming user name
+ # passed.
+ # If the information is both a valid user name and user number, we
+ # prefer the name because we try it second. A minor point, hopefully.
+ try:
+ pw_ent = pwd.getpwnam(options.user)
+ setuid = pw_ent.pw_uid
+ setgid = pw_ent.pw_gid
+ username = pw_ent.pw_name
+ except KeyError:
+ pass
+
+ if setuid is None:
+ logger.fatal(BIND10_INVALID_USER, options.user)
+ sys.exit(1)
+
+ # Create wakeup pipe for signal handlers
+ wakeup_pipe = os.pipe()
+ signal.set_wakeup_fd(wakeup_pipe[1])
+
+ # Set signal handlers for catching child termination, as well
+ # as our own demise.
+ signal.signal(signal.SIGCHLD, reaper)
+ signal.siginterrupt(signal.SIGCHLD, False)
+ signal.signal(signal.SIGINT, fatal_signal)
+ signal.signal(signal.SIGTERM, fatal_signal)
+
+ # Block SIGPIPE, as we don't want it to end this process
+ signal.signal(signal.SIGPIPE, signal.SIG_IGN)
+
+ try:
+ b10_init = Init(options.msgq_socket_file, options.data_path,
+ options.config_file, options.clear_config,
+ options.verbose, options.nokill,
+ setuid, setgid, username, options.cmdctl_port,
+ options.wait_time)
+ startup_result = b10_init.startup()
+ if startup_result:
+ logger.fatal(BIND10_STARTUP_ERROR, startup_result)
+ sys.exit(1)
+ b10_init.init_socket_srv()
+ logger.info(BIND10_STARTUP_COMPLETE)
+ dump_pid(options.pid_file)
+
+ # Let it run
+ b10_init.run(wakeup_pipe[0])
+
+ # shutdown
+ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+ b10_init.shutdown()
+ finally:
+ # Clean up the filesystem
+ unlink_pid_file(options.pid_file)
+ remove_lock_files()
+ if b10_init is not None:
+ b10_init.remove_socket_srv()
+ sys.exit(b10_init.exitcode)
+
+if __name__ == "__main__":
+ main()
diff --git a/src/bin/bind10/init.spec b/src/bin/bind10/init.spec
new file mode 100644
index 0000000..62c6f09
--- /dev/null
+++ b/src/bin/bind10/init.spec
@@ -0,0 +1,92 @@
+{
+ "module_spec": {
+ "module_name": "Init",
+ "module_description": "Init process",
+ "config_data": [
+ {
+ "item_name": "components",
+ "item_type": "named_set",
+ "item_optional": false,
+ "item_default": {
+ "b10-stats": { "address": "Stats", "kind": "dispensable" },
+ "b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
+ },
+ "named_set_item_spec": {
+ "item_name": "component",
+ "item_type": "map",
+ "item_optional": false,
+ "item_default": { },
+ "map_item_spec": [
+ {
+ "item_name": "special",
+ "item_optional": true,
+ "item_type": "string"
+ },
+ {
+ "item_name": "process",
+ "item_optional": true,
+ "item_type": "string"
+ },
+ {
+ "item_name": "kind",
+ "item_optional": false,
+ "item_type": "string",
+ "item_default": "dispensable"
+ },
+ {
+ "item_name": "address",
+ "item_optional": true,
+ "item_type": "string"
+ },
+ {
+ "item_name": "params",
+ "item_optional": true,
+ "item_type": "list",
+ "list_item_spec": {
+ "item_name": "param",
+ "item_optional": false,
+ "item_type": "string",
+ "item_default": ""
+ }
+ },
+ {
+ "item_name": "priority",
+ "item_optional": true,
+ "item_type": "integer"
+ }
+ ]
+ }
+ }
+ ],
+ "commands": [
+ {
+ "command_name": "shutdown",
+ "command_description": "Shut down BIND 10",
+ "command_args": []
+ },
+ {
+ "command_name": "ping",
+ "command_description": "Ping the b10-init process",
+ "command_args": []
+ },
+ {
+ "command_name": "show_processes",
+ "command_description": "List the running BIND 10 processes",
+ "command_args": []
+ }
+ ],
+ "statistics": [
+ {
+ "item_name": "boot_time",
+ "item_type": "string",
+ "item_optional": false,
+ "item_default": "1970-01-01T00:00:00Z",
+ "item_title": "Boot time",
+ "item_description": "A date time when bind10 process starts initially",
+ "item_format": "date-time"
+ }
+ ]
+ }
+}
+
+
diff --git a/src/bin/bind10/init_messages.mes b/src/bin/bind10/init_messages.mes
new file mode 100644
index 0000000..9cdb7ef
--- /dev/null
+++ b/src/bin/bind10/init_messages.mes
@@ -0,0 +1,327 @@
+# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# No namespace declaration - these constants go in the global namespace
+# of the xfrin messages python module.
+
+% BIND10_CHECK_MSGQ_ALREADY_RUNNING checking if msgq is already running
+The b10-init process is starting up and will now check if the message bus
+daemon is already running. If so, it will not be able to start, as it
+needs a dedicated message bus.
+
+% BIND10_COMPONENT_FAILED component %1 (pid %2) failed: %3
+The process terminated, but b10-init didn't expect it to, which means
+it must have failed.
+
+% BIND10_COMPONENT_RESTART component %1 is about to restart
+The named component failed previously and we will try to restart it to provide
+as flawless service as possible, but it should be investigated what happened,
+as it could happen again.
+
+% BIND10_COMPONENT_START component %1 is starting
+The named component is about to be started by the b10-init process.
+
+% BIND10_COMPONENT_START_EXCEPTION component %1 failed to start: %2
+An exception (mentioned in the message) happened during the startup of the
+named component. The componet is not considered started and further actions
+will be taken about it.
+
+% BIND10_COMPONENT_STOP component %1 is being stopped
+A component is about to be asked to stop willingly by the b10-init.
+
+% BIND10_COMPONENT_UNSATISFIED component %1 is required to run and failed
+A component failed for some reason (see previous messages). It is either a core
+component or needed component that was just started. In any case, the system
+can't continue without it and will terminate.
+
+% BIND10_CONFIGURATOR_BUILD building plan '%1' -> '%2'
+A debug message. This indicates that the configurator is building a plan
+how to change configuration from the older one to newer one. This does no
+real work yet, it just does the planning what needs to be done.
+
+% BIND10_CONFIGURATOR_PLAN_INTERRUPTED configurator plan interrupted, only %1 of %2 done
+There was an exception during some planned task. The plan will not continue and
+only some tasks of the plan were completed. The rest is aborted. The exception
+will be propagated.
+
+% BIND10_CONFIGURATOR_RECONFIGURE reconfiguring running components
+A different configuration of which components should be running is being
+installed. All components that are no longer needed will be stopped and
+newly introduced ones started. This happens at startup, when the configuration
+is read the first time, or when an operator changes configuration of the b10-init.
+
+% BIND10_CONFIGURATOR_RUN running plan of %1 tasks
+A debug message. The configurator is about to execute a plan of actions it
+computed previously.
+
+% BIND10_CONFIGURATOR_START bind10 component configurator is starting up
+The part that cares about starting and stopping the right component from
+the b10-init process is starting up. This happens only once at the startup
+of the b10-init process. It will start the basic set of processes now (the
+ones b10-init needs to read the configuration), the rest will be started
+after the configuration is known.
+
+% BIND10_CONFIGURATOR_STOP bind10 component configurator is shutting down
+The part that cares about starting and stopping processes in the b10-init is
+shutting down. All started components will be shut down now (more precisely,
+asked to terminate by their own, if they fail to comply, other parts of
+the b10-init process will try to force them).
+
+% BIND10_CONFIGURATOR_TASK performing task %1 on %2
+A debug message. The configurator is about to perform one task of the plan it
+is currently executing on the named component.
+
+% BIND10_CONNECTING_TO_CC_FAIL failed to connect to configuration/command channel; try -v to see output from msgq
+The b10-init process tried to connect to the communication channel for
+commands and configuration updates during initialization, but it
+failed. This is a fatal startup error, and process will soon
+terminate after some cleanup. There can be several reasons for the
+failure, but the most likely cause is that the msgq daemon failed to
+start, and the most likely cause of the msgq failure is that it
+doesn't have a permission to create a socket file for the
+communication. To confirm that, you can see debug messages from msgq
+by starting BIND 10 with the -v command line option. If it indicates
+permission problem for msgq, make sure the directory where the socket
+file is to be created is writable for the msgq process. Note that if
+you specify the -u option to change process users, the directory must
+be writable for that user.
+
+% BIND10_INVALID_STATISTICS_DATA invalid specification of statistics data specified
+An error was encountered when the b10-init module specified
+statistics data which is invalid for the b10-init specification file.
+
+% BIND10_INVALID_USER invalid user: %1
+The b10-init process was started with the -u option, to drop root privileges
+and continue running as the specified user, but the user is unknown.
+
+% BIND10_KILLING_ALL_PROCESSES killing all started processes
+The b10-init module was not able to start every process it needed to start
+during startup, and will now kill the processes that did get started.
+
+% BIND10_LOST_SOCKET_CONSUMER consumer %1 of sockets disconnected, considering all its sockets closed
+A connection from one of the applications which requested a socket was
+closed. This means the application has terminated, so all the sockets it was
+using are now closed and bind10 process can release them as well, unless the
+same sockets are used by yet another application.
+
+% BIND10_MSGQ_ALREADY_RUNNING msgq daemon already running, cannot start
+There already appears to be a message bus daemon running. Either an
+old process was not shut down correctly, and needs to be killed, or
+another instance of BIND10, with the same msgq domain socket, is
+running, which needs to be stopped.
+
+% BIND10_MSGQ_DISAPPEARED msgq channel disappeared
+While listening on the message bus channel for messages, it suddenly
+disappeared. The msgq daemon may have died. This might lead to an
+inconsistent state of the system, and BIND 10 will now shut down.
+
+% BIND10_NO_SOCKET couldn't send a socket for token %1 because of error: %2
+An error occurred when the bind10 process was asked to send a socket file
+descriptor. The error is mentioned, most common reason is that the request
+is invalid and may not come from bind10 process at all.
+
+% BIND10_PROCESS_ENDED process %2 of %1 ended with status %3
+This indicates a process started previously terminated. The process id
+and component owning the process are indicated, as well as the exit code.
+This doesn't distinguish if the process was supposed to terminate or not.
+
+% BIND10_READING_INIT_CONFIGURATION reading b10-init configuration
+The b10-init process is starting up, and will now process the initial
+configuration, as received from the configuration manager.
+
+% BIND10_RECEIVED_COMMAND received command: %1
+The b10-init module received a command and shall now process it. The command
+is printed.
+
+% BIND10_RECEIVED_NEW_CONFIGURATION received new configuration: %1
+The b10-init module received a configuration update and is going to apply
+it now. The new configuration is printed.
+
+% BIND10_RECEIVED_SIGNAL received signal %1
+The b10-init module received the given signal.
+
+% BIND10_RESTART_COMPONENT_SKIPPED Skipped restarting a component %1
+The b10-init module tried to restart a component after it failed (crashed)
+unexpectedly, but the b10-init then found that the component had been removed
+from its local configuration of components to run. This is an unusual
+situation but can happen if the administrator removes the component from
+the configuration after the component's crash and before the restart time.
+The b10-init module simply skipped restarting that module, and the whole system
+went back to the expected state (except that the crash itself is likely
+to be a bug).
+
+% BIND10_RESURRECTED_PROCESS resurrected %1 (PID %2)
+The given process has been restarted successfully, and is now running
+with the given process id.
+
+% BIND10_RESURRECTING_PROCESS resurrecting dead %1 process...
+The given process has ended unexpectedly, and is now restarted.
+
+% BIND10_SELECT_ERROR error in select() call: %1
+There was a fatal error in the call to select(), used to see if a child
+process has ended or if there is a message on the message bus. This
+should not happen under normal circumstances and is considered fatal,
+so BIND 10 will now shut down. The specific error is printed.
+
+% BIND10_SEND_SIGKILL sending SIGKILL to %1 (PID %2)
+The b10-init module is sending a SIGKILL signal to the given process.
+
+% BIND10_SEND_SIGNAL_FAIL sending %1 to %2 (PID %3) failed: %4
+The b10-init module sent a single (either SIGTERM or SIGKILL) to a process,
+but it failed due to some system level error. There are two major cases:
+the target process has already terminated but the b10-init module had sent
+the signal before it noticed the termination. In this case an error
+message should indicate something like "no such process". This can be
+safely ignored. The other case is that the b10-init module doesn't have
+the privilege to send a signal to the process. It can typically
+happen when the b10-init module started as a privileged process, spawned a
+subprocess, and then dropped the privilege. It includes the case for
+the socket creator when the b10-init process runs with the -u command line
+option. In this case, the b10-init module simply gives up to terminate
+the process explicitly because it's unlikely to succeed by keeping
+sending the signal. Although the socket creator is implemented so
+that it will terminate automatically when the b10-init process exits
+(and that should be the case for any other future process running with
+a higher privilege), but it's recommended to check if there's any
+remaining BIND 10 process if this message is logged. For all other
+cases, the b10-init module will keep sending the signal until it confirms
+all child processes terminate. Although unlikely, this could prevent
+the b10-init module from exiting, just keeping sending the signals. So,
+again, it's advisable to check if it really terminates when this
+message is logged.
+
+% BIND10_SEND_SIGTERM sending SIGTERM to %1 (PID %2)
+The b10-init module is sending a SIGTERM signal to the given process.
+
+% BIND10_SETGID setting GID to %1
+The b10-init switches the process group ID to the given value. This happens
+when BIND 10 starts with the -u option, and the group ID will be set to
+that of the specified user.
+
+% BIND10_SETUID setting UID to %1
+The b10-init switches the user it runs as to the given UID.
+
+% BIND10_SHUTDOWN stopping the server
+The b10-init process received a command or signal telling it to shut down.
+It will send a shutdown command to each process. The processes that do
+not shut down will then receive a SIGTERM signal. If that doesn't work,
+it shall send SIGKILL signals to the processes still alive.
+
+% BIND10_SHUTDOWN_COMPLETE all processes ended, shutdown complete
+All child processes have been stopped, and the b10-init process will now
+stop itself.
+
+% BIND10_SOCKCREATOR_BAD_CAUSE unknown error cause from socket creator: %1
+The socket creator reported an error when creating a socket. But the function
+which failed is unknown (not one of 'S' for socket or 'B' for bind).
+
+% BIND10_SOCKCREATOR_BAD_RESPONSE unknown response for socket request: %1
+The b10-init requested a socket from the creator, but the answer is unknown. This
+looks like a programmer error.
+
+% BIND10_SOCKCREATOR_EOF eof while expecting data from socket creator
+There should be more data from the socket creator, but it closed the socket.
+It probably crashed.
+
+% BIND10_SOCKCREATOR_INIT initializing socket creator parser
+The b10-init module initializes routines for parsing the socket creator
+protocol.
+
+% BIND10_SOCKCREATOR_KILL killing the socket creator
+The socket creator is being terminated the aggressive way, by sending it
+sigkill. This should not happen usually.
+
+% BIND10_SOCKCREATOR_TERMINATE terminating socket creator
+The b10-init module sends a request to terminate to the socket creator.
+
+% BIND10_SOCKCREATOR_TRANSPORT_ERROR transport error when talking to the socket creator: %1
+Either sending or receiving data from the socket creator failed with the given
+error. The creator probably crashed or some serious OS-level problem happened,
+as the communication happens only on local host.
+
+% BIND10_SOCKET_CREATED successfully created socket %1
+The socket creator successfully created and sent a requested socket, it has
+the given file number.
+
+% BIND10_SOCKET_ERROR error on %1 call in the creator: %2/%3
+The socket creator failed to create the requested socket. It failed on the
+indicated OS API function with given error.
+
+% BIND10_SOCKET_GET requesting socket [%1]:%2 of type %3 from the creator
+The b10-init forwards a request for a socket to the socket creator.
+
+% BIND10_STARTED_CC started configuration/command session
+Debug message given when BIND 10 has successfully started the object that
+handles configuration and commands.
+
+% BIND10_STARTED_PROCESS started %1
+The given process has successfully been started.
+
+% BIND10_STARTED_PROCESS_PID started %1 (PID %2)
+The given process has successfully been started, and has the given PID.
+
+% BIND10_STARTING starting BIND10: %1
+Informational message on startup that shows the full version.
+
+% BIND10_STARTING_CC starting configuration/command session
+Informational message given when BIND 10 is starting the session object
+that handles configuration and commands.
+
+% BIND10_STARTING_PROCESS starting process %1
+The b10-init module is starting the given process.
+
+% BIND10_STARTING_PROCESS_PORT starting process %1 (to listen on port %2)
+The b10-init module is starting the given process, which will listen on the
+given port number.
+
+% BIND10_STARTING_PROCESS_PORT_ADDRESS starting process %1 (to listen on %2#%3)
+The b10-init module is starting the given process, which will listen on the
+given address and port number (written as <address>#<port>).
+
+% BIND10_STARTUP_COMPLETE BIND 10 started
+All modules have been successfully started, and BIND 10 is now running.
+
+% BIND10_STARTUP_ERROR error during startup: %1
+There was a fatal error when BIND10 was trying to start. The error is
+shown, and BIND10 will now shut down.
+
+% BIND10_STARTUP_UNEXPECTED_MESSAGE unrecognised startup message %1
+During the startup process, a number of messages are exchanged between the
+Init process and the processes it starts. This error is output when a
+message received by the Init process is recognised as being of the
+correct format but is unexpected. It may be that processes are starting
+of sequence.
+
+% BIND10_STARTUP_UNRECOGNISED_MESSAGE unrecognised startup message %1
+During the startup process, a number of messages are exchanged between the
+Init process and the processes it starts. This error is output when a
+message received by the Init process is not recognised.
+
+% BIND10_STOP_PROCESS asking %1 to shut down
+The b10-init module is sending a shutdown command to the given module over
+the message channel.
+
+% BIND10_UNKNOWN_CHILD_PROCESS_ENDED unknown child pid %1 exited
+An unknown child process has exited. The PID is printed, but no further
+action will be taken by the b10-init process.
+
+% BIND10_WAIT_CFGMGR waiting for configuration manager process to initialize
+The configuration manager process is so critical to operation of BIND 10
+that after starting it, the Init module will wait for it to initialize
+itself before continuing. This debug message is produced during the
+wait and may be output zero or more times depending on how long it takes
+the configuration manager to start up. The total length of time Init
+will wait for the configuration manager before reporting an error is
+set with the command line --wait switch, which has a default value of
+ten seconds.
diff --git a/src/bin/bind10/run_bind10.sh.in b/src/bin/bind10/run_bind10.sh.in
index 17d2c53..8121eba 100755
--- a/src/bin/bind10/run_bind10.sh.in
+++ b/src/bin/bind10/run_bind10.sh.in
@@ -45,5 +45,5 @@ export B10_FROM_BUILD
BIND10_MSGQ_SOCKET_FILE=@abs_top_builddir@/msgq_socket
export BIND10_MSGQ_SOCKET_FILE
-exec ${PYTHON_EXEC} -O ${BIND10_PATH}/bind10 "$@"
+exec ${BIND10_PATH}/b10-init "$@"
diff --git a/src/bin/bind10/tests/args_test.py b/src/bin/bind10/tests/args_test.py
index 93a7cea..2447a62 100644
--- a/src/bin/bind10/tests/args_test.py
+++ b/src/bin/bind10/tests/args_test.py
@@ -1,5 +1,5 @@
"""
-This program tests the boss process to make sure that it runs while
+This program tests the b10-init process to make sure that it runs while
dropping permissions. It must be run as a user that can set permission.
"""
import unittest
@@ -17,69 +17,69 @@ SUID_USER="shane"
BIND10_EXE="../run_bind10.sh"
TIMEOUT=3
-class TestBossArgs(unittest.TestCase):
- def _waitForString(self, bob, s):
+class TestInitArgs(unittest.TestCase):
+ def _waitForString(self, init, s):
found_string = False
start_time = time.time()
while time.time() < start_time + TIMEOUT:
- (r,w,x) = select.select((bob.stdout,), (), (), TIMEOUT)
- if bob.stdout in r:
- s = bob.stdout.readline()
+ (r,w,x) = select.select((init.stdout,), (), (), TIMEOUT)
+ if init.stdout in r:
+ s = init.stdout.readline()
if s == '':
break
- if s.startswith(s):
+ if s.startswith(s):
found_string = True
break
return found_string
def testNoArgs(self):
"""Run bind10 without any arguments"""
- bob = subprocess.Popen(args=(BIND10_EXE,),
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- started_ok = self._waitForString(bob, '[bind10] BIND 10 started')
+ init = subprocess.Popen(args=(BIND10_EXE,),
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ started_ok = self._waitForString(init, '[bind10] BIND 10 started')
time.sleep(0.1)
- bob.terminate()
- bob.wait()
+ init.terminate()
+ init.wait()
self.assertTrue(started_ok)
def testBadOption(self):
"""Run bind10 with a bogus option"""
- bob = subprocess.Popen(args=(BIND10_EXE, "--badoption"),
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- failed = self._waitForString(bob, 'bind10: error: no such option: --badoption')
+ init = subprocess.Popen(args=(BIND10_EXE, "--badoption"),
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ failed = self._waitForString(init, 'bind10: error: no such option: --badoption')
time.sleep(0.1)
- bob.terminate()
- self.assertTrue(bob.wait() == 2)
+ init.terminate()
+ self.assertTrue(init.wait() == 2)
self.assertTrue(failed)
def testArgument(self):
"""Run bind10 with an argument (this is not allowed)"""
- bob = subprocess.Popen(args=(BIND10_EXE, "argument"),
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- failed = self._waitForString(bob, 'Usage: bind10 [options]')
+ init = subprocess.Popen(args=(BIND10_EXE, "argument"),
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ failed = self._waitForString(init, 'Usage: bind10 [options]')
time.sleep(0.1)
- bob.terminate()
- self.assertTrue(bob.wait() == 1)
+ init.terminate()
+ self.assertTrue(init.wait() == 1)
self.assertTrue(failed)
def testBadUser(self):
"""Run bind10 with a bogus user"""
- bob = subprocess.Popen(args=(BIND10_EXE, "-u", "bogus_user"),
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- failed = self._waitForString(bob, "bind10: invalid user: 'bogus_user'")
+ init = subprocess.Popen(args=(BIND10_EXE, "-u", "bogus_user"),
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ failed = self._waitForString(init, "bind10: invalid user: 'bogus_user'")
time.sleep(0.1)
- bob.terminate()
- self.assertTrue(bob.wait() == 1)
+ init.terminate()
+ self.assertTrue(init.wait() == 1)
self.assertTrue(failed)
def testBadUid(self):
"""Run bind10 with a bogus user ID"""
- bob = subprocess.Popen(args=(BIND10_EXE, "-u", "999999999"),
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- failed = self._waitForString(bob, "bind10: invalid user: '999999999'")
+ init = subprocess.Popen(args=(BIND10_EXE, "-u", "999999999"),
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ failed = self._waitForString(init, "bind10: invalid user: '999999999'")
time.sleep(0.1)
- bob.terminate()
- self.assertTrue(bob.wait() == 1)
+ init.terminate()
+ self.assertTrue(init.wait() == 1)
self.assertTrue(failed)
def testFailSetUser(self):
@@ -90,12 +90,12 @@ class TestBossArgs(unittest.TestCase):
if os.getuid() == 0:
self.skipTest("test must not be run as root (uid is 0)")
# XXX: we depend on the "nobody" user
- bob = subprocess.Popen(args=(BIND10_EXE, "-u", "nobody"),
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- failed = self._waitForString(bob, "[bind10] Error on startup: Unable to start b10-msgq; Unable to change to user nobody")
+ init = subprocess.Popen(args=(BIND10_EXE, "-u", "nobody"),
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ failed = self._waitForString(init, "[bind10] Error on startup: Unable to start b10-msgq; Unable to change to user nobody")
time.sleep(0.1)
- bob.terminate()
- self.assertTrue(bob.wait() == 1)
+ init.terminate()
+ self.assertTrue(init.wait() == 1)
self.assertTrue(failed)
def testSetUser(self):
@@ -108,9 +108,9 @@ class TestBossArgs(unittest.TestCase):
if os.geteuid() != 0:
self.skipTest("test must run as root (euid is not 0)")
- bob = subprocess.Popen(args=(BIND10_EXE, "-u", SUID_USER),
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- started_ok = self._waitForString(bob, '[bind10] BIND 10 started')
+ init = subprocess.Popen(args=(BIND10_EXE, "-u", SUID_USER),
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ started_ok = self._waitForString(init, '[bind10] BIND 10 started')
self.assertTrue(started_ok)
ps = subprocess.Popen(args=("ps", "axo", "user,pid"),
stdout=subprocess.PIPE)
@@ -120,22 +120,22 @@ class TestBossArgs(unittest.TestCase):
s = ps.stdout.readline()
if s == '': break
(user, pid) = s.split()
- if int(pid) == bob.pid:
+ if int(pid) == init.pid:
ps_user = user.decode()
break
self.assertTrue(ps_user is not None)
self.assertTrue(ps_user == SUID_USER)
time.sleep(0.1)
- bob.terminate()
- x = bob.wait()
- self.assertTrue(bob.wait() == 0)
+ init.terminate()
+ x = init.wait()
+ self.assertTrue(init.wait() == 0)
def testPrettyName(self):
"""Try the --pretty-name option."""
- CMD_PRETTY_NAME = b'bob-name-test'
- bob = subprocess.Popen(args=(BIND10_EXE, '--pretty-name',
+ CMD_PRETTY_NAME = b'init-name-test'
+ init = subprocess.Popen(args=(BIND10_EXE, '--pretty-name',
CMD_PRETTY_NAME), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- started_ok = self._waitForString(bob, '[bind10] BIND 10 started')
+ started_ok = self._waitForString(init, '[bind10] BIND 10 started')
self.assertTrue(started_ok)
ps = subprocess.Popen(args=("ps", "axo", "pid,comm"),
stdout=subprocess.PIPE)
@@ -145,13 +145,13 @@ class TestBossArgs(unittest.TestCase):
s = ps.stdout.readline()
if s == '': break
(pid,comm) = s.split(None, 1)
- if int(pid) == bob.pid:
+ if int(pid) == init.pid:
command = comm
break
self.assertEqual(command, CMD_PRETTY_NAME + b'\n')
time.sleep(0.1)
- bob.terminate()
- bob.wait()
+ init.terminate()
+ init.wait()
if __name__ == '__main__':
unittest.main()
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index ccfa831..36b98fe 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -13,11 +13,11 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-# Most of the time, we omit the "bind10_src" for brevity. Sometimes,
+# Most of the time, we omit the "init" for brevity. Sometimes,
# we want to be explicit about what we do, like when hijacking a library
-# call used by the bind10_src.
-from bind10_src import ProcessInfo, BoB, parse_args, dump_pid, unlink_pid_file, _BASETIME
-import bind10_src
+# call used by the b10-init.
+from init import Init, ProcessInfo, parse_args, dump_pid, unlink_pid_file, _BASETIME
+import init
# XXX: environment tests are currently disabled, due to the preprocessor
# setup that we have now complicating the environment
@@ -108,19 +108,19 @@ class TestProcessInfo(unittest.TestCase):
class TestCacheCommands(unittest.TestCase):
"""
- Test methods of boss related to the socket cache and socket handling.
+ Test methods of b10-init related to the socket cache and socket handling.
"""
def setUp(self):
"""
- Prepare the boss for some tests.
+ Prepare b10-init for some tests.
Also prepare some variables we need.
"""
- self.__boss = BoB()
+ self.__b10_init = Init()
# Fake the cache here so we can pretend it is us and hijack the
# calls to its methods.
- self.__boss._socket_cache = self
- self.__boss._socket_path = '/socket/path'
+ self.__b10_init._socket_cache = self
+ self.__b10_init._socket_path = '/socket/path'
self.__raise_exception = None
self.__socket_args = {
"port": 53,
@@ -135,11 +135,11 @@ class TestCacheCommands(unittest.TestCase):
self.__send_fd_called = None
self.__get_token_called = None
self.__drop_socket_called = None
- bind10_src.libutil_io_python.send_fd = self.__send_fd
+ init.libutil_io_python.send_fd = self.__send_fd
def __send_fd(self, to, socket):
"""
- A function to hook the send_fd in the bind10_src.
+ A function to hook the send_fd in the b10-init.
"""
self.__send_fd_called = (to, socket)
@@ -178,18 +178,18 @@ class TestCacheCommands(unittest.TestCase):
"""
Test that it calls the drop_application method of the cache.
"""
- self.__boss.socket_consumer_dead(self.FalseSocket())
+ self.__b10_init.socket_consumer_dead(self.FalseSocket())
self.assertEqual(42, self.__drop_app_called)
def test_consumer_dead_invalid(self):
"""
Test that it doesn't crash in case the application is not known to
- the cache, the boss doesn't crash, as this actually can happen in
+ the cache, the b10_init doesn't crash, as this actually can happen in
practice.
"""
self.__raise_exception = ValueError("This application is unknown")
# This doesn't crash
- self.__boss.socket_consumer_dead(self.FalseSocket())
+ self.__b10_init.socket_consumer_dead(self.FalseSocket())
def get_socket(self, token, application):
"""
@@ -210,7 +210,7 @@ class TestCacheCommands(unittest.TestCase):
socket = self.FalseSocket()
# An exception from the cache
self.__raise_exception = ValueError("Test value error")
- self.__boss.socket_request_handler(b"token", socket)
+ self.__b10_init.socket_request_handler(b"token", socket)
# It was called, but it threw, so it is not noted here
self.assertIsNone(self.__get_socket_called)
self.assertEqual(b"0\n", socket.send)
@@ -219,7 +219,7 @@ class TestCacheCommands(unittest.TestCase):
# Now prepare a valid scenario
self.__raise_exception = None
socket.send = b""
- self.__boss.socket_request_handler(b"token", socket)
+ self.__b10_init.socket_request_handler(b"token", socket)
self.assertEqual(b"1\n", socket.send)
self.assertEqual((42, 13), self.__send_fd_called)
self.assertEqual(("token", 42), self.__get_socket_called)
@@ -240,7 +240,7 @@ class TestCacheCommands(unittest.TestCase):
"""
Test the successful scenario of getting a socket.
"""
- result = self.__boss._get_socket(self.__socket_args)
+ result = self.__b10_init._get_socket(self.__socket_args)
[code, answer] = result['result']
self.assertEqual(0, code)
self.assertEqual({
@@ -264,7 +264,7 @@ class TestCacheCommands(unittest.TestCase):
The rest is not tested, as it is already checked in the
test_get_socket_ok.
"""
- [rcode, ranswer] = self.__boss._get_socket(args)['result']
+ [rcode, ranswer] = self.__b10_init._get_socket(args)['result']
self.assertEqual(code, rcode)
if code != 0:
# This should be an error message. The exact formatting
@@ -325,44 +325,44 @@ class TestCacheCommands(unittest.TestCase):
"""
# This should be OK and just propagated to the call.
self.assertEqual({"result": [0]},
- self.__boss.command_handler("drop_socket",
- {"token": "token"}))
+ self.__b10_init.command_handler("drop_socket",
+ {"token": "token"}))
self.assertEqual("token", self.__drop_socket_called)
self.__drop_socket_called = None
# Missing parameter
self.assertEqual({"result": [1, "Missing token parameter"]},
- self.__boss.command_handler("drop_socket", {}))
+ self.__b10_init.command_handler("drop_socket", {}))
self.assertIsNone(self.__drop_socket_called)
# An exception is raised from within the cache
self.__raise_exception = ValueError("Test error")
self.assertEqual({"result": [1, "Test error"]},
- self.__boss.command_handler("drop_socket",
+ self.__b10_init.command_handler("drop_socket",
{"token": "token"}))
-class TestBoB(unittest.TestCase):
+class TestInit(unittest.TestCase):
def setUp(self):
# Save original values that may be tweaked in some tests
- self.__orig_setgid = bind10_src.posix.setgid
- self.__orig_setuid = bind10_src.posix.setuid
+ self.__orig_setgid = init.posix.setgid
+ self.__orig_setuid = init.posix.setuid
self.__orig_logger_class = isc.log.Logger
def tearDown(self):
# Restore original values saved in setUp()
- bind10_src.posix.setgid = self.__orig_setgid
- bind10_src.posix.setuid = self.__orig_setuid
+ init.posix.setgid = self.__orig_setgid
+ init.posix.setuid = self.__orig_setuid
isc.log.Logger = self.__orig_logger_class
def test_init(self):
- bob = BoB()
- self.assertEqual(bob.verbose, False)
- self.assertEqual(bob.msgq_socket_file, None)
- self.assertEqual(bob.cc_session, None)
- self.assertEqual(bob.ccs, None)
- self.assertEqual(bob.components, {})
- self.assertEqual(bob.runnable, False)
- self.assertEqual(bob.username, None)
- self.assertIsNone(bob._socket_cache)
+ b10_init = Init()
+ self.assertEqual(b10_init.verbose, False)
+ self.assertEqual(b10_init.msgq_socket_file, None)
+ self.assertEqual(b10_init.cc_session, None)
+ self.assertEqual(b10_init.ccs, None)
+ self.assertEqual(b10_init.components, {})
+ self.assertEqual(b10_init.runnable, False)
+ self.assertEqual(b10_init.username, None)
+ self.assertIsNone(b10_init._socket_cache)
def __setgid(self, gid):
self.__gid_set = gid
@@ -371,18 +371,18 @@ class TestBoB(unittest.TestCase):
self.__uid_set = uid
def test_change_user(self):
- bind10_src.posix.setgid = self.__setgid
- bind10_src.posix.setuid = self.__setuid
+ init.posix.setgid = self.__setgid
+ init.posix.setuid = self.__setuid
self.__gid_set = None
self.__uid_set = None
- bob = BoB()
- bob.change_user()
- # No gid/uid set in boss, nothing called.
+ b10_init = Init()
+ b10_init.change_user()
+ # No gid/uid set in init, nothing called.
self.assertIsNone(self.__gid_set)
self.assertIsNone(self.__uid_set)
- BoB(setuid=42, setgid=4200).change_user()
+ Init(setuid=42, setgid=4200).change_user()
# This time, it get's called
self.assertEqual(4200, self.__gid_set)
self.assertEqual(42, self.__uid_set)
@@ -393,65 +393,65 @@ class TestBoB(unittest.TestCase):
raise ex
# Let setgid raise an exception
- bind10_src.posix.setgid = raising_set_xid
- bind10_src.posix.setuid = self.__setuid
- self.assertRaises(bind10_src.ChangeUserError,
- BoB(setuid=42, setgid=4200).change_user)
+ init.posix.setgid = raising_set_xid
+ init.posix.setuid = self.__setuid
+ self.assertRaises(init.ChangeUserError,
+ Init(setuid=42, setgid=4200).change_user)
# Let setuid raise an exception
- bind10_src.posix.setgid = self.__setgid
- bind10_src.posix.setuid = raising_set_xid
- self.assertRaises(bind10_src.ChangeUserError,
- BoB(setuid=42, setgid=4200).change_user)
+ init.posix.setgid = self.__setgid
+ init.posix.setuid = raising_set_xid
+ self.assertRaises(init.ChangeUserError,
+ Init(setuid=42, setgid=4200).change_user)
# Let initial log output after setuid raise an exception
- bind10_src.posix.setgid = self.__setgid
- bind10_src.posix.setuid = self.__setuid
+ init.posix.setgid = self.__setgid
+ init.posix.setuid = self.__setuid
isc.log.Logger = raising_set_xid
- self.assertRaises(bind10_src.ChangeUserError,
- BoB(setuid=42, setgid=4200).change_user)
+ self.assertRaises(init.ChangeUserError,
+ Init(setuid=42, setgid=4200).change_user)
def test_set_creator(self):
"""
Test the call to set_creator. First time, the cache is created
with the passed creator. The next time, it throws an exception.
"""
- bob = BoB()
+ init = Init()
# The cache doesn't use it at start, so just create an empty class
class Creator: pass
creator = Creator()
- bob.set_creator(creator)
- self.assertTrue(isinstance(bob._socket_cache,
+ init.set_creator(creator)
+ self.assertTrue(isinstance(init._socket_cache,
isc.bind10.socket_cache.Cache))
- self.assertEqual(creator, bob._socket_cache._creator)
- self.assertRaises(ValueError, bob.set_creator, creator)
+ self.assertEqual(creator, init._socket_cache._creator)
+ self.assertRaises(ValueError, init.set_creator, creator)
def test_socket_srv(self):
"""Tests init_socket_srv() and remove_socket_srv() work as expected."""
- bob = BoB()
+ init = Init()
- self.assertIsNone(bob._srv_socket)
- self.assertIsNone(bob._tmpdir)
- self.assertIsNone(bob._socket_path)
+ self.assertIsNone(init._srv_socket)
+ self.assertIsNone(init._tmpdir)
+ self.assertIsNone(init._socket_path)
- bob.init_socket_srv()
+ init.init_socket_srv()
- self.assertIsNotNone(bob._srv_socket)
- self.assertNotEqual(-1, bob._srv_socket.fileno())
- self.assertEqual(os.path.join(bob._tmpdir, 'sockcreator'),
- bob._srv_socket.getsockname())
+ self.assertIsNotNone(init._srv_socket)
+ self.assertNotEqual(-1, init._srv_socket.fileno())
+ self.assertEqual(os.path.join(init._tmpdir, 'sockcreator'),
+ init._srv_socket.getsockname())
- self.assertIsNotNone(bob._tmpdir)
- self.assertTrue(os.path.isdir(bob._tmpdir))
- self.assertIsNotNone(bob._socket_path)
- self.assertTrue(os.path.exists(bob._socket_path))
+ self.assertIsNotNone(init._tmpdir)
+ self.assertTrue(os.path.isdir(init._tmpdir))
+ self.assertIsNotNone(init._socket_path)
+ self.assertTrue(os.path.exists(init._socket_path))
# Check that it's possible to connect to the socket file (this
# only works if the socket file exists and the server listens on
# it).
s = socket.socket(socket.AF_UNIX)
try:
- s.connect(bob._socket_path)
+ s.connect(init._socket_path)
can_connect = True
s.close()
except socket.error as e:
@@ -459,29 +459,29 @@ class TestBoB(unittest.TestCase):
self.assertTrue(can_connect)
- bob.remove_socket_srv()
+ init.remove_socket_srv()
- self.assertEqual(-1, bob._srv_socket.fileno())
- self.assertFalse(os.path.exists(bob._socket_path))
- self.assertFalse(os.path.isdir(bob._tmpdir))
+ self.assertEqual(-1, init._srv_socket.fileno())
+ self.assertFalse(os.path.exists(init._socket_path))
+ self.assertFalse(os.path.isdir(init._tmpdir))
# These should not fail either:
# second call
- bob.remove_socket_srv()
+ init.remove_socket_srv()
- bob._srv_socket = None
- bob.remove_socket_srv()
+ init._srv_socket = None
+ init.remove_socket_srv()
def test_init_alternate_socket(self):
- bob = BoB("alt_socket_file")
- self.assertEqual(bob.verbose, False)
- self.assertEqual(bob.msgq_socket_file, "alt_socket_file")
- self.assertEqual(bob.cc_session, None)
- self.assertEqual(bob.ccs, None)
- self.assertEqual(bob.components, {})
- self.assertEqual(bob.runnable, False)
- self.assertEqual(bob.username, None)
+ init = Init("alt_socket_file")
+ self.assertEqual(init.verbose, False)
+ self.assertEqual(init.msgq_socket_file, "alt_socket_file")
+ self.assertEqual(init.cc_session, None)
+ self.assertEqual(init.ccs, None)
+ self.assertEqual(init.components, {})
+ self.assertEqual(init.runnable, False)
+ self.assertEqual(init.username, None)
def test_command_handler(self):
class DummySession():
@@ -490,7 +490,7 @@ class TestBoB(unittest.TestCase):
def group_recvmsg(self, nonblock, seq): pass
class DummyModuleCCSession():
module_spec = isc.config.module_spec.ModuleSpec({
- "module_name": "Boss",
+ "module_name": "Init",
"statistics": [
{
"item_name": "boot_time",
@@ -505,38 +505,38 @@ class TestBoB(unittest.TestCase):
})
def get_module_spec(self):
return self.module_spec
- bob = BoB()
- bob.verbose = True
- bob.cc_session = DummySession()
- bob.ccs = DummyModuleCCSession()
+ init = Init()
+ init.verbose = True
+ init.cc_session = DummySession()
+ init.ccs = DummyModuleCCSession()
# a bad command
- self.assertEqual(bob.command_handler(-1, None),
+ self.assertEqual(init.command_handler(-1, None),
isc.config.ccsession.create_answer(1, "bad command"))
# "shutdown" command
- self.assertEqual(bob.command_handler("shutdown", None),
+ self.assertEqual(init.command_handler("shutdown", None),
isc.config.ccsession.create_answer(0))
- self.assertFalse(bob.runnable)
+ self.assertFalse(init.runnable)
# "getstats" command
- self.assertEqual(bob.command_handler("getstats", None),
+ self.assertEqual(init.command_handler("getstats", None),
isc.config.ccsession.create_answer(0,
{ 'boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME) }))
# "ping" command
- self.assertEqual(bob.command_handler("ping", None),
+ self.assertEqual(init.command_handler("ping", None),
isc.config.ccsession.create_answer(0, "pong"))
# "show_processes" command
- self.assertEqual(bob.command_handler("show_processes", None),
+ self.assertEqual(init.command_handler("show_processes", None),
isc.config.ccsession.create_answer(0,
- bob.get_processes()))
+ init.get_processes()))
# an unknown command
- self.assertEqual(bob.command_handler("__UNKNOWN__", None),
+ self.assertEqual(init.command_handler("__UNKNOWN__", None),
isc.config.ccsession.create_answer(1, "Unknown command"))
# Fake the get_token of cache and test the command works
- bob._socket_path = '/socket/path'
+ init._socket_path = '/socket/path'
class cache:
def get_token(self, protocol, addr, port, share_mode, share_name):
return str(addr) + ':' + str(port)
- bob._socket_cache = cache()
+ init._socket_cache = cache()
args = {
"port": 53,
"address": "0.0.0.0",
@@ -547,7 +547,7 @@ class TestBoB(unittest.TestCase):
# at all and this is the easiest way to check.
self.assertEqual({'result': [0, {'token': '0.0.0.0:53',
'path': '/socket/path'}]},
- bob.command_handler("get_socket", args))
+ init.command_handler("get_socket", args))
# The drop_socket is not tested here, but in TestCacheCommands.
# It needs the cache mocks to be in place and they are there.
@@ -559,15 +559,15 @@ class TestBoB(unittest.TestCase):
class DummySession():
def group_sendmsg(self, msg, group, instance="*"):
(self.msg, self.group, self.instance) = (msg, group, instance)
- bob = BoB()
- bob.cc_session = DummySession()
- bob.stop_process('process', 'address', 42)
- self.assertEqual('address', bob.cc_session.group)
- self.assertEqual('address', bob.cc_session.instance)
+ init = Init()
+ init.cc_session = DummySession()
+ init.stop_process('process', 'address', 42)
+ self.assertEqual('address', init.cc_session.group)
+ self.assertEqual('address', init.cc_session.instance)
self.assertEqual({'command': ['shutdown', {'pid': 42}]},
- bob.cc_session.msg)
+ init.cc_session.msg)
-# Mock class for testing BoB's usage of ProcessInfo
+# Mock class for testing Init's usage of ProcessInfo
class MockProcessInfo:
def __init__(self, name, args, env={}, dev_null_stdout=False,
dev_null_stderr=False):
@@ -583,17 +583,17 @@ class MockProcessInfo:
# set some pid (only used for testing that it is not None anymore)
self.pid = 42147
-# Class for testing the BoB without actually starting processes.
+# Class for testing the Init without actually starting processes.
# This is used for testing the start/stop components routines and
-# the BoB commands.
+# the Init commands.
#
# Testing that external processes start is outside the scope
# of the unit test, by overriding the process start methods we can check
# that the right processes are started depending on the configuration
# options.
-class MockBob(BoB):
+class MockInit(Init):
def __init__(self):
- BoB.__init__(self)
+ Init.__init__(self)
# Set flags as to which of the overridden methods has been run.
self.msgq = False
@@ -615,10 +615,12 @@ class MockBob(BoB):
self.get_process_exit_status_called = False
class MockSockCreator(isc.bind10.component.Component):
- def __init__(self, process, boss, kind, address=None, params=None):
- isc.bind10.component.Component.__init__(self, process, boss,
- kind, 'SockCreator')
- self._start_func = boss.start_creator
+ def __init__(self, process, b10_init, kind, address=None,
+ params=None):
+ isc.bind10.component.Component.__init__(self, process,
+ b10_init, kind,
+ 'SockCreator')
+ self._start_func = b10_init.start_creator
specials = isc.bind10.special_component.get_specials()
specials['sockcreator'] = MockSockCreator
@@ -810,9 +812,9 @@ class MockBob(BoB):
return MockProcessInfo(name, args, c_channel_env,
dev_null_stdout, dev_null_stderr)
-class MockBobSimple(BoB):
+class MockInitSimple(Init):
def __init__(self):
- BoB.__init__(self)
+ Init.__init__(self)
# Set which process has been started
self.started_process_name = None
self.started_process_args = None
@@ -830,7 +832,7 @@ class MockBobSimple(BoB):
self.started_process_env = c_channel_env
return None
-class TestStartStopProcessesBob(unittest.TestCase):
+class TestStartStopProcessesInit(unittest.TestCase):
"""
Check that the start_all_components method starts the right combination
of components and that the right components are started and stopped
@@ -840,66 +842,66 @@ class TestStartStopProcessesBob(unittest.TestCase):
# Check whether the environment has not been changed
self.assertEqual(original_os_environ, os.environ)
- def check_started(self, bob, core, auth, resolver):
+ def check_started(self, init, core, auth, resolver):
"""
Check that the right sets of services are started. The ones that
should be running are specified by the core, auth and resolver parameters
(they are groups of processes, eg. auth means b10-auth, -xfrout, -xfrin
and -zonemgr).
"""
- self.assertEqual(bob.msgq, core)
- self.assertEqual(bob.cfgmgr, core)
- self.assertEqual(bob.ccsession, core)
- self.assertEqual(bob.creator, core)
- self.assertEqual(bob.auth, auth)
- self.assertEqual(bob.resolver, resolver)
- self.assertEqual(bob.xfrout, auth)
- self.assertEqual(bob.xfrin, auth)
- self.assertEqual(bob.zonemgr, auth)
- self.assertEqual(bob.stats, core)
- self.assertEqual(bob.stats_httpd, core)
- self.assertEqual(bob.cmdctl, core)
+ self.assertEqual(init.msgq, core)
+ self.assertEqual(init.cfgmgr, core)
+ self.assertEqual(init.ccsession, core)
+ self.assertEqual(init.creator, core)
+ self.assertEqual(init.auth, auth)
+ self.assertEqual(init.resolver, resolver)
+ self.assertEqual(init.xfrout, auth)
+ self.assertEqual(init.xfrin, auth)
+ self.assertEqual(init.zonemgr, auth)
+ self.assertEqual(init.stats, core)
+ self.assertEqual(init.stats_httpd, core)
+ self.assertEqual(init.cmdctl, core)
self.check_environment_unchanged()
- def check_preconditions(self, bob):
- self.check_started(bob, False, False, False)
+ def check_preconditions(self, init):
+ self.check_started(init, False, False, False)
- def check_started_none(self, bob):
+ def check_started_none(self, init):
"""
Check that the situation is according to configuration where no servers
should be started. Some components still need to be running.
"""
- self.check_started(bob, True, False, False)
+ self.check_started(init, True, False, False)
self.check_environment_unchanged()
- def check_started_both(self, bob):
+ def check_started_both(self, init):
"""
Check the situation is according to configuration where both servers
(auth and resolver) are enabled.
"""
- self.check_started(bob, True, True, True)
+ self.check_started(init, True, True, True)
self.check_environment_unchanged()
- def check_started_auth(self, bob):
+ def check_started_auth(self, init):
"""
Check the set of components needed to run auth only is started.
"""
- self.check_started(bob, True, True, False)
+ self.check_started(init, True, True, False)
self.check_environment_unchanged()
- def check_started_resolver(self, bob):
+ def check_started_resolver(self, init):
"""
Check the set of components needed to run resolver only is started.
"""
- self.check_started(bob, True, False, True)
+ self.check_started(init, True, False, True)
self.check_environment_unchanged()
- def check_started_dhcp(self, bob, v4, v6):
+ def check_started_dhcp(self, init, v4, v6):
"""
Check if proper combinations of DHCPv4 and DHCpv6 can be started
"""
- self.assertEqual(v4, bob.dhcp4)
- self.assertEqual(v6, bob.dhcp6)
+ self.assertEqual(v4, init.dhcp4)
+ self.assertEqual(v6, init.dhcp6)
self.check_environment_unchanged()
def construct_config(self, start_auth, start_resolver):
@@ -926,21 +928,21 @@ class TestStartStopProcessesBob(unittest.TestCase):
"""
Test the configuration is loaded at the startup.
"""
- bob = MockBob()
+ init = MockInit()
config = self.construct_config(start_auth, start_resolver)
class CC:
def get_full_config(self):
return config
# Provide the fake CC with data
- bob.ccs = CC()
+ init.ccs = CC()
# And make sure it's not overwritten
def start_ccsession():
- bob.ccsession = True
- bob.start_ccsession = lambda _: start_ccsession()
+ init.ccsession = True
+ init.start_ccsession = lambda _: start_ccsession()
# We need to return the original _read_bind10_config
- bob._read_bind10_config = lambda: BoB._read_bind10_config(bob)
- bob.start_all_components()
- self.check_started(bob, True, start_auth, start_resolver)
+ init._read_bind10_config = lambda: Init._read_bind10_config(init)
+ init.start_all_components()
+ self.check_started(init, True, start_auth, start_resolver)
self.check_environment_unchanged()
def test_start_none(self):
@@ -961,137 +963,137 @@ class TestStartStopProcessesBob(unittest.TestCase):
to configuration changes.
"""
- # Create BoB and ensure correct initialization
- bob = MockBob()
- self.check_preconditions(bob)
+ # Create Init and ensure correct initialization
+ init = MockInit()
+ self.check_preconditions(init)
- bob.start_all_components()
- bob.runnable = True
- bob.config_handler(self.construct_config(False, False))
- self.check_started_none(bob)
+ init.start_all_components()
+ init.runnable = True
+ init.config_handler(self.construct_config(False, False))
+ self.check_started_none(init)
# Enable both at once
- bob.config_handler(self.construct_config(True, True))
- self.check_started_both(bob)
+ init.config_handler(self.construct_config(True, True))
+ self.check_started_both(init)
# Not touched by empty change
- bob.config_handler({})
- self.check_started_both(bob)
+ init.config_handler({})
+ self.check_started_both(init)
# Not touched by change to the same configuration
- bob.config_handler(self.construct_config(True, True))
- self.check_started_both(bob)
+ init.config_handler(self.construct_config(True, True))
+ self.check_started_both(init)
# Turn them both off again
- bob.config_handler(self.construct_config(False, False))
- self.check_started_none(bob)
+ init.config_handler(self.construct_config(False, False))
+ self.check_started_none(init)
# Not touched by empty change
- bob.config_handler({})
- self.check_started_none(bob)
+ init.config_handler({})
+ self.check_started_none(init)
# Not touched by change to the same configuration
- bob.config_handler(self.construct_config(False, False))
- self.check_started_none(bob)
+ init.config_handler(self.construct_config(False, False))
+ self.check_started_none(init)
# Start and stop auth separately
- bob.config_handler(self.construct_config(True, False))
- self.check_started_auth(bob)
+ init.config_handler(self.construct_config(True, False))
+ self.check_started_auth(init)
- bob.config_handler(self.construct_config(False, False))
- self.check_started_none(bob)
+ init.config_handler(self.construct_config(False, False))
+ self.check_started_none(init)
# Start and stop resolver separately
- bob.config_handler(self.construct_config(False, True))
- self.check_started_resolver(bob)
+ init.config_handler(self.construct_config(False, True))
+ self.check_started_resolver(init)
- bob.config_handler(self.construct_config(False, False))
- self.check_started_none(bob)
+ init.config_handler(self.construct_config(False, False))
+ self.check_started_none(init)
# Alternate
- bob.config_handler(self.construct_config(True, False))
- self.check_started_auth(bob)
+ init.config_handler(self.construct_config(True, False))
+ self.check_started_auth(init)
- bob.config_handler(self.construct_config(False, True))
- self.check_started_resolver(bob)
+ init.config_handler(self.construct_config(False, True))
+ self.check_started_resolver(init)
- bob.config_handler(self.construct_config(True, False))
- self.check_started_auth(bob)
+ init.config_handler(self.construct_config(True, False))
+ self.check_started_auth(init)
def test_config_start_once(self):
"""
Tests that a component is started only once.
"""
- # Create BoB and ensure correct initialization
- bob = MockBob()
- self.check_preconditions(bob)
+ # Create Init and ensure correct initialization
+ init = MockInit()
+ self.check_preconditions(init)
- bob.start_all_components()
+ init.start_all_components()
- bob.runnable = True
- bob.config_handler(self.construct_config(True, True))
- self.check_started_both(bob)
+ init.runnable = True
+ init.config_handler(self.construct_config(True, True))
+ self.check_started_both(init)
- bob.start_auth = lambda: self.fail("Started auth again")
- bob.start_xfrout = lambda: self.fail("Started xfrout again")
- bob.start_xfrin = lambda: self.fail("Started xfrin again")
- bob.start_zonemgr = lambda: self.fail("Started zonemgr again")
- bob.start_resolver = lambda: self.fail("Started resolver again")
+ init.start_auth = lambda: self.fail("Started auth again")
+ init.start_xfrout = lambda: self.fail("Started xfrout again")
+ init.start_xfrin = lambda: self.fail("Started xfrin again")
+ init.start_zonemgr = lambda: self.fail("Started zonemgr again")
+ init.start_resolver = lambda: self.fail("Started resolver again")
# Send again we want to start them. Should not do it, as they are.
- bob.config_handler(self.construct_config(True, True))
+ init.config_handler(self.construct_config(True, True))
def test_config_not_started_early(self):
"""
Test that components are not started by the config handler before
startup.
"""
- bob = MockBob()
- self.check_preconditions(bob)
+ init = MockInit()
+ self.check_preconditions(init)
- bob.start_auth = lambda: self.fail("Started auth again")
- bob.start_xfrout = lambda: self.fail("Started xfrout again")
- bob.start_xfrin = lambda: self.fail("Started xfrin again")
- bob.start_zonemgr = lambda: self.fail("Started zonemgr again")
- bob.start_resolver = lambda: self.fail("Started resolver again")
+ init.start_auth = lambda: self.fail("Started auth again")
+ init.start_xfrout = lambda: self.fail("Started xfrout again")
+ init.start_xfrin = lambda: self.fail("Started xfrin again")
+ init.start_zonemgr = lambda: self.fail("Started zonemgr again")
+ init.start_resolver = lambda: self.fail("Started resolver again")
- bob.config_handler({'start_auth': True, 'start_resolver': True})
+ init.config_handler({'start_auth': True, 'start_resolver': True})
# Checks that DHCP (v4 and v6) components are started when expected
def test_start_dhcp(self):
- # Create BoB and ensure correct initialization
- bob = MockBob()
- self.check_preconditions(bob)
+ # Create Init and ensure correct initialization
+ init = MockInit()
+ self.check_preconditions(init)
- bob.start_all_components()
- bob.config_handler(self.construct_config(False, False))
- self.check_started_dhcp(bob, False, False)
+ init.start_all_components()
+ init.config_handler(self.construct_config(False, False))
+ self.check_started_dhcp(init, False, False)
def test_start_dhcp_v6only(self):
- # Create BoB and ensure correct initialization
- bob = MockBob()
- self.check_preconditions(bob)
+ # Create Init and ensure correct initialization
+ init = MockInit()
+ self.check_preconditions(init)
# v6 only enabled
- bob.start_all_components()
- bob.runnable = True
- bob._BoB_started = True
+ init.start_all_components()
+ init.runnable = True
+ init._Init_started = True
config = self.construct_config(False, False)
config['components']['b10-dhcp6'] = { 'kind': 'needed',
'address': 'Dhcp6' }
- bob.config_handler(config)
- self.check_started_dhcp(bob, False, True)
+ init.config_handler(config)
+ self.check_started_dhcp(init, False, True)
# uncomment when dhcpv4 becomes implemented
# v4 only enabled
- #bob.cfg_start_dhcp6 = False
- #bob.cfg_start_dhcp4 = True
- #self.check_started_dhcp(bob, True, False)
+ #init.cfg_start_dhcp6 = False
+ #init.cfg_start_dhcp4 = True
+ #self.check_started_dhcp(init, True, False)
# both v4 and v6 enabled
- #bob.cfg_start_dhcp6 = True
- #bob.cfg_start_dhcp4 = True
- #self.check_started_dhcp(bob, True, True)
+ #init.cfg_start_dhcp6 = True
+ #init.cfg_start_dhcp4 = True
+ #self.check_started_dhcp(init, True, True)
class MockComponent:
def __init__(self, name, pid, address=None):
@@ -1119,31 +1121,31 @@ class MockComponent:
def kill(self, forceful):
self.forceful = forceful
-class TestBossCmd(unittest.TestCase):
+class TestInitCmd(unittest.TestCase):
def test_ping(self):
"""
Confirm simple ping command works.
"""
- bob = MockBob()
- answer = bob.command_handler("ping", None)
+ init = MockInit()
+ answer = init.command_handler("ping", None)
self.assertEqual(answer, {'result': [0, 'pong']})
def test_show_processes_empty(self):
"""
Confirm getting a list of processes works.
"""
- bob = MockBob()
- answer = bob.command_handler("show_processes", None)
+ init = MockInit()
+ answer = init.command_handler("show_processes", None)
self.assertEqual(answer, {'result': [0, []]})
def test_show_processes(self):
"""
Confirm getting a list of processes works.
"""
- bob = MockBob()
- bob.register_process(1, MockComponent('first', 1))
- bob.register_process(2, MockComponent('second', 2, 'Second'))
- answer = bob.command_handler("show_processes", None)
+ init = MockInit()
+ init.register_process(1, MockComponent('first', 1))
+ init.register_process(2, MockComponent('second', 2, 'Second'))
+ answer = init.command_handler("show_processes", None)
processes = [[1, 'first', None],
[2, 'second', 'Second']]
self.assertEqual(answer, {'result': [0, processes]})
@@ -1274,9 +1276,9 @@ class TestPIDFile(unittest.TestCase):
self.assertRaises(IOError, dump_pid,
'nonexistent_dir' + os.sep + 'bind10.pid')
-class TestBossComponents(unittest.TestCase):
+class TestInitComponents(unittest.TestCase):
"""
- Test the boss propagates component configuration properly to the
+ Test b10-init propagates component configuration properly to the
component configurator and acts sane.
"""
def setUp(self):
@@ -1341,34 +1343,34 @@ class TestBossComponents(unittest.TestCase):
Test the situation when we run in usual scenario, nothing fails,
we just start, reconfigure and then stop peacefully.
"""
- bob = MockBob()
+ init = MockInit()
# Start it
- orig = bob._component_configurator.startup
- bob._component_configurator.startup = self.__unary_hook
- bob.start_all_components()
- bob._component_configurator.startup = orig
+ orig = init._component_configurator.startup
+ init._component_configurator.startup = self.__unary_hook
+ init.start_all_components()
+ init._component_configurator.startup = orig
self.__check_core(self.__param)
self.assertEqual(3, len(self.__param))
# Reconfigure it
self.__param = None
- orig = bob._component_configurator.reconfigure
- bob._component_configurator.reconfigure = self.__unary_hook
+ orig = init._component_configurator.reconfigure
+ init._component_configurator.reconfigure = self.__unary_hook
# Otherwise it does not work
- bob.runnable = True
- bob.config_handler({'components': self.__compconfig})
+ init.runnable = True
+ init.config_handler({'components': self.__compconfig})
self.__check_extended(self.__param)
currconfig = self.__param
# If we reconfigure it, but it does not contain the components part,
# nothing is called
- bob.config_handler({})
+ init.config_handler({})
self.assertEqual(self.__param, currconfig)
self.__param = None
- bob._component_configurator.reconfigure = orig
+ init._component_configurator.reconfigure = orig
# Check a configuration that messes up the core components is rejected.
compconf = dict(self.__compconfig)
compconf['msgq'] = { 'process': 'echo' }
- result = bob.config_handler({'components': compconf})
+ result = init.config_handler({'components': compconf})
# Check it rejected it
self.assertEqual(1, result['result'][0])
@@ -1380,8 +1382,8 @@ class TestBossComponents(unittest.TestCase):
"""
Helper function that does the actual kill functionality testing.
"""
- bob = MockBob()
- bob.nokill = nokill
+ init = MockInit()
+ init.nokill = nokill
killed = []
class ImmortalComponent:
@@ -1405,28 +1407,28 @@ class TestBossComponents(unittest.TestCase):
# In the case of ESRCH, the process should have gone
# somehow, so we clear the components.
if ex_on_kill.errno == errno.ESRCH:
- bob.components = {}
+ init.components = {}
raise ex_on_kill
if forceful:
- bob.components = {}
+ init.components = {}
def pid(self):
return 1
def name(self):
return "Immortal"
- bob.components = {}
- bob.register_process(1, ImmortalComponent())
+ init.components = {}
+ init.register_process(1, ImmortalComponent())
# While at it, we check the configurator shutdown is actually called
- orig = bob._component_configurator.shutdown
- bob._component_configurator.shutdown = self.__nullary_hook
+ orig = init._component_configurator.shutdown
+ init._component_configurator.shutdown = self.__nullary_hook
self.__called = False
- bob.ccs = MockModuleCCSession()
- self.assertFalse(bob.ccs.stopped)
+ init.ccs = MockModuleCCSession()
+ self.assertFalse(init.ccs.stopped)
- bob.shutdown()
+ init.shutdown()
- self.assertTrue(bob.ccs.stopped)
+ self.assertTrue(init.ccs.stopped)
# Here, killed is an array where False is added if SIGTERM
# should be sent, or True if SIGKILL should be sent, in order in
@@ -1441,11 +1443,11 @@ class TestBossComponents(unittest.TestCase):
self.assertTrue(self.__called)
- bob._component_configurator.shutdown = orig
+ init._component_configurator.shutdown = orig
def test_kills(self):
"""
- Test that the boss kills components which don't want to stop.
+ Test that b10-init kills components which don't want to stop.
"""
self.__real_test_kill()
@@ -1465,9 +1467,9 @@ class TestBossComponents(unittest.TestCase):
def test_nokill(self):
"""
- Test that the boss *doesn't* kill components which don't want to
+ Test that b10-init *doesn't* kill components which don't want to
stop, when asked not to (by passing the --no-kill option which
- sets bob.nokill to True).
+ sets init.nokill to True).
"""
self.__real_test_kill(True)
@@ -1475,62 +1477,62 @@ class TestBossComponents(unittest.TestCase):
"""
Test the component_shutdown sets all variables accordingly.
"""
- bob = MockBob()
- self.assertRaises(Exception, bob.component_shutdown, 1)
- self.assertEqual(1, bob.exitcode)
- bob._BoB__started = True
- bob.component_shutdown(2)
- self.assertEqual(2, bob.exitcode)
- self.assertFalse(bob.runnable)
+ init = MockInit()
+ self.assertRaises(Exception, init.component_shutdown, 1)
+ self.assertEqual(1, init.exitcode)
+ init._Init__started = True
+ init.component_shutdown(2)
+ self.assertEqual(2, init.exitcode)
+ self.assertFalse(init.runnable)
def test_init_config(self):
"""
Test initial configuration is loaded.
"""
- bob = MockBob()
+ init = MockInit()
# Start it
- bob._component_configurator.reconfigure = self.__unary_hook
+ init._component_configurator.reconfigure = self.__unary_hook
# We need to return the original read_bind10_config
- bob._read_bind10_config = lambda: BoB._read_bind10_config(bob)
+ init._read_bind10_config = lambda: Init._read_bind10_config(init)
# And provide a session to read the data from
class CC:
pass
- bob.ccs = CC()
- bob.ccs.get_full_config = lambda: {'components': self.__compconfig}
- bob.start_all_components()
+ init.ccs = CC()
+ init.ccs.get_full_config = lambda: {'components': self.__compconfig}
+ init.start_all_components()
self.__check_extended(self.__param)
- def __setup_restart(self, bob, component):
+ def __setup_restart(self, init, component):
'''Common procedure for restarting a component used below.'''
- bob.components_to_restart = { component }
+ init.components_to_restart = { component }
component.restarted = False
- bob.restart_processes()
+ init.restart_processes()
def test_restart_processes(self):
'''Check some behavior on restarting processes.'''
- bob = MockBob()
- bob.runnable = True
+ init = MockInit()
+ init.runnable = True
component = MockComponent('test', 53)
# A component to be restarted will actually be restarted iff it's
# in the configurator's configuration.
# We bruteforce the configurator internal below; ugly, but the easiest
# way for the test.
- bob._component_configurator._components['test'] = (None, component)
- self.__setup_restart(bob, component)
+ init._component_configurator._components['test'] = (None, component)
+ self.__setup_restart(init, component)
self.assertTrue(component.restarted)
- self.assertNotIn(component, bob.components_to_restart)
+ self.assertNotIn(component, init.components_to_restart)
# Remove the component from the configuration. It won't be restarted
# even if scheduled, nor will remain in the to-be-restarted list.
- del bob._component_configurator._components['test']
- self.__setup_restart(bob, component)
+ del init._component_configurator._components['test']
+ self.__setup_restart(init, component)
self.assertFalse(component.restarted)
- self.assertNotIn(component, bob.components_to_restart)
+ self.assertNotIn(component, init.components_to_restart)
def test_get_processes(self):
'''Test that procsses are returned correctly, sorted by pid.'''
- bob = MockBob()
+ init = MockInit()
pids = list(range(0, 20))
random.shuffle(pids)
@@ -1539,9 +1541,9 @@ class TestBossComponents(unittest.TestCase):
pid = pids[i]
component = MockComponent('test' + str(pid), pid,
'Test' + str(pid))
- bob.components[pid] = component
+ init.components[pid] = component
- process_list = bob.get_processes()
+ process_list = init.get_processes()
self.assertEqual(20, len(process_list))
last_pid = -1
@@ -1553,30 +1555,30 @@ class TestBossComponents(unittest.TestCase):
process)
def _test_reap_children_helper(self, runnable, is_running, failed):
- '''Construct a BoB instance, set various data in it according to
+ '''Construct a Init instance, set various data in it according to
passed args and check if the component was added to the list of
components to restart.'''
- bob = MockBob()
- bob.runnable = runnable
+ init = MockInit()
+ init.runnable = runnable
component = MockComponent('test', 53)
component.running = is_running
component.has_failed = failed
- bob.components[53] = component
+ init.components[53] = component
- self.assertNotIn(component, bob.components_to_restart)
+ self.assertNotIn(component, init.components_to_restart)
- bob.reap_children()
+ init.reap_children()
if runnable and is_running and not failed:
- self.assertIn(component, bob.components_to_restart)
+ self.assertIn(component, init.components_to_restart)
else:
- self.assertEqual([], bob.components_to_restart)
+ self.assertEqual([], init.components_to_restart)
def test_reap_children(self):
'''Test that children are queued to be restarted when they ask for it.'''
# test various combinations of 3 booleans
- # (BoB.runnable, component.is_running(), component.failed())
+ # (Init.runnable, component.is_running(), component.failed())
self._test_reap_children_helper(False, False, False)
self._test_reap_children_helper(False, False, True)
self._test_reap_children_helper(False, True, False)
@@ -1587,58 +1589,58 @@ class TestBossComponents(unittest.TestCase):
self._test_reap_children_helper(True, True, True)
# setup for more tests below
- bob = MockBob()
- bob.runnable = True
+ init = MockInit()
+ init.runnable = True
component = MockComponent('test', 53)
- bob.components[53] = component
+ init.components[53] = component
# case where the returned pid is unknown to us. nothing should
# happpen then.
- bob.get_process_exit_status_called = False
- bob._get_process_exit_status = bob._get_process_exit_status_unknown_pid
- bob.components_to_restart = []
+ init.get_process_exit_status_called = False
+ init._get_process_exit_status = init._get_process_exit_status_unknown_pid
+ init.components_to_restart = []
# this should do nothing as the pid is unknown
- bob.reap_children()
- self.assertEqual([], bob.components_to_restart)
+ init.reap_children()
+ self.assertEqual([], init.components_to_restart)
- # case where bob._get_process_exit_status() raises OSError with
+ # case where init._get_process_exit_status() raises OSError with
# errno.ECHILD
- bob._get_process_exit_status = \
- bob._get_process_exit_status_raises_oserror_echild
- bob.components_to_restart = []
+ init._get_process_exit_status = \
+ init._get_process_exit_status_raises_oserror_echild
+ init.components_to_restart = []
# this should catch and handle the OSError
- bob.reap_children()
- self.assertEqual([], bob.components_to_restart)
+ init.reap_children()
+ self.assertEqual([], init.components_to_restart)
- # case where bob._get_process_exit_status() raises OSError with
+ # case where init._get_process_exit_status() raises OSError with
# errno other than ECHILD
- bob._get_process_exit_status = \
- bob._get_process_exit_status_raises_oserror_other
+ init._get_process_exit_status = \
+ init._get_process_exit_status_raises_oserror_other
with self.assertRaises(OSError):
- bob.reap_children()
+ init.reap_children()
- # case where bob._get_process_exit_status() raises something
+ # case where init._get_process_exit_status() raises something
# other than OSError
- bob._get_process_exit_status = \
- bob._get_process_exit_status_raises_other
+ init._get_process_exit_status = \
+ init._get_process_exit_status_raises_other
with self.assertRaises(Exception):
- bob.reap_children()
+ init.reap_children()
def test_kill_started_components(self):
'''Test that started components are killed.'''
- bob = MockBob()
+ init = MockInit()
component = MockComponent('test', 53, 'Test')
- bob.components[53] = component
+ init.components[53] = component
- self.assertEqual([[53, 'test', 'Test']], bob.get_processes())
- bob.kill_started_components()
- self.assertEqual([], bob.get_processes())
+ self.assertEqual([[53, 'test', 'Test']], init.get_processes())
+ init.kill_started_components()
+ self.assertEqual([], init.get_processes())
self.assertTrue(component.forceful)
- def _start_msgq_helper(self, bob, verbose):
- bob.verbose = verbose
- pi = bob.start_msgq()
+ def _start_msgq_helper(self, init, verbose):
+ init.verbose = verbose
+ pi = init.start_msgq()
self.assertEqual('b10-msgq', pi.name)
self.assertEqual(['b10-msgq'], pi.args)
self.assertTrue(pi.dev_null_stdout)
@@ -1650,31 +1652,31 @@ class TestBossComponents(unittest.TestCase):
def test_start_msgq(self):
'''Test that b10-msgq is started.'''
- bob = MockBobSimple()
- bob.c_channel_env = {'FOO': 'an env string'}
- bob._run_under_unittests = True
+ init = MockInitSimple()
+ init.c_channel_env = {'FOO': 'an env string'}
+ init._run_under_unittests = True
# use the MockProcessInfo creator
- bob._make_process_info = bob._make_mock_process_info
+ init._make_process_info = init._make_mock_process_info
# non-verbose case
- self._start_msgq_helper(bob, False)
+ self._start_msgq_helper(init, False)
# verbose case
- self._start_msgq_helper(bob, True)
+ self._start_msgq_helper(init, True)
def test_start_msgq_timeout(self):
'''Test that b10-msgq startup attempts connections several times
and times out eventually.'''
- bob = MockBobSimple()
- bob.c_channel_env = {}
+ b10_init = MockInitSimple()
+ b10_init.c_channel_env = {}
# set the timeout to an arbitrary pre-determined value (which
# code below depends on)
- bob.msgq_timeout = 1
- bob._run_under_unittests = False
+ b10_init.msgq_timeout = 1
+ b10_init._run_under_unittests = False
# use the MockProcessInfo creator
- bob._make_process_info = bob._make_mock_process_info
+ b10_init._make_process_info = b10_init._make_mock_process_info
global attempts
global tsec
@@ -1704,10 +1706,10 @@ class TestBossComponents(unittest.TestCase):
isc.cc.Session = DummySessionAlwaysFails
- with self.assertRaises(bind10_src.CChannelConnectError):
+ with self.assertRaises(init.CChannelConnectError):
# An exception will be thrown here when it eventually times
# out.
- pi = bob.start_msgq()
+ pi = b10_init.start_msgq()
# time.time() should be called 12 times within the while loop:
# starting from 0, and 11 more times from 0.1 to 1.1. There's
@@ -1735,30 +1737,30 @@ class TestBossComponents(unittest.TestCase):
attempts = 0
tsec = 0
- pi = bob.start_msgq()
+ pi = b10_init.start_msgq()
# just one attempt, but 2 calls to time.time()
self.assertEqual(attempts, 2)
- self.assertEqual(cc_socket_file, bob.msgq_socket_file)
- self.assertEqual(cc_sub, 'Boss')
+ self.assertEqual(cc_socket_file, b10_init.msgq_socket_file)
+ self.assertEqual(cc_sub, 'Init')
# isc.cc.Session, time.time() and time.sleep() are restored
# during tearDown().
- def _start_cfgmgr_helper(self, bob, data_path, filename, clear_config):
+ def _start_cfgmgr_helper(self, init, data_path, filename, clear_config):
expect_args = ['b10-cfgmgr']
if data_path is not None:
- bob.data_path = data_path
+ init.data_path = data_path
expect_args.append('--data-path=' + data_path)
if filename is not None:
- bob.config_filename = filename
+ init.config_filename = filename
expect_args.append('--config-filename=' + filename)
if clear_config:
- bob.clear_config = clear_config
+ init.clear_config = clear_config
expect_args.append('--clear-config')
- pi = bob.start_cfgmgr()
+ pi = init.start_cfgmgr()
self.assertEqual('b10-cfgmgr', pi.name)
self.assertEqual(expect_args, pi.args)
self.assertEqual({'TESTENV': 'A test string'}, pi.env)
@@ -1779,13 +1781,13 @@ class TestBossComponents(unittest.TestCase):
else:
return ({}, None)
- bob = MockBobSimple()
- bob.c_channel_env = {'TESTENV': 'A test string'}
- bob.cc_session = DummySession()
- bob.wait_time = 5
+ init = MockInitSimple()
+ init.c_channel_env = {'TESTENV': 'A test string'}
+ init.cc_session = DummySession()
+ init.wait_time = 5
# use the MockProcessInfo creator
- bob._make_process_info = bob._make_mock_process_info
+ init._make_process_info = init._make_mock_process_info
global attempts
attempts = 0
@@ -1796,24 +1798,24 @@ class TestBossComponents(unittest.TestCase):
time.sleep = _my_sleep
# defaults
- self._start_cfgmgr_helper(bob, None, None, False)
+ self._start_cfgmgr_helper(init, None, None, False)
# check that 2 attempts were made. on the 3rd attempt,
# process_running() returns that ConfigManager is running.
self.assertEqual(attempts, 2)
# data_path is specified
- self._start_cfgmgr_helper(bob, '/var/lib/test', None, False)
+ self._start_cfgmgr_helper(init, '/var/lib/test', None, False)
- # config_filename is specified. Because `bob` is not
+ # config_filename is specified. Because `init` is not
# reconstructed, data_path is retained from the last call to
# _start_cfgmgr_helper().
- self._start_cfgmgr_helper(bob, '/var/lib/test', 'foo.cfg', False)
+ self._start_cfgmgr_helper(init, '/var/lib/test', 'foo.cfg', False)
- # clear_config is specified. Because `bob` is not reconstructed,
+ # clear_config is specified. Because `init` is not reconstructed,
# data_path and config_filename are retained from the last call
# to _start_cfgmgr_helper().
- self._start_cfgmgr_helper(bob, '/var/lib/test', 'foo.cfg', True)
+ self._start_cfgmgr_helper(init, '/var/lib/test', 'foo.cfg', True)
def test_start_cfgmgr_timeout(self):
'''Test that b10-cfgmgr startup attempts connections several times
@@ -1821,15 +1823,15 @@ class TestBossComponents(unittest.TestCase):
class DummySession():
def group_recvmsg(self):
return (None, None)
- bob = MockBobSimple()
- bob.c_channel_env = {}
- bob.cc_session = DummySession()
+ b10_init = MockInitSimple()
+ b10_init.c_channel_env = {}
+ b10_init.cc_session = DummySession()
# set wait_time to an arbitrary pre-determined value (which code
# below depends on)
- bob.wait_time = 2
+ b10_init.wait_time = 2
# use the MockProcessInfo creator
- bob._make_process_info = bob._make_mock_process_info
+ b10_init._make_process_info = b10_init._make_mock_process_info
global attempts
attempts = 0
@@ -1841,8 +1843,8 @@ class TestBossComponents(unittest.TestCase):
# We just check that an exception was thrown, and that several
# attempts were made to connect.
- with self.assertRaises(bind10_src.ProcessStartError):
- pi = bob.start_cfgmgr()
+ with self.assertRaises(init.ProcessStartError):
+ pi = b10_init.start_cfgmgr()
# 2 seconds of attempts every 1 second should result in 2 attempts
self.assertEqual(attempts, 2)
@@ -1861,27 +1863,28 @@ class TestBossComponents(unittest.TestCase):
self.started = False
def start(self):
self.started = True
- bob = MockBobSimple()
+ b10_init = MockInitSimple()
self._tmp_module_cc_session = isc.config.ModuleCCSession
isc.config.ModuleCCSession = DummySession
- bob.start_ccsession({})
- self.assertEqual(bind10_src.SPECFILE_LOCATION, bob.ccs.specfile)
- self.assertEqual(bob.config_handler, bob.ccs.config_handler)
- self.assertEqual(bob.command_handler, bob.ccs.command_handler)
- self.assertEqual(bob.msgq_socket_file, bob.ccs.socket_file)
- self.assertTrue(bob.ccs.started)
+ b10_init.start_ccsession({})
+ self.assertEqual(init.SPECFILE_LOCATION, b10_init.ccs.specfile)
+ self.assertEqual(b10_init.config_handler, b10_init.ccs.config_handler)
+ self.assertEqual(b10_init.command_handler,
+ b10_init.ccs.command_handler)
+ self.assertEqual(b10_init.msgq_socket_file, b10_init.ccs.socket_file)
+ self.assertTrue(b10_init.ccs.started)
# isc.config.ModuleCCSession is restored during tearDown().
def test_start_process(self):
'''Test that processes can be started.'''
- bob = MockBob()
+ init = MockInit()
# use the MockProcessInfo creator
- bob._make_process_info = bob._make_mock_process_info
+ init._make_process_info = init._make_mock_process_info
- pi = bob.start_process('Test Process', ['/bin/true'], {})
+ pi = init.start_process('Test Process', ['/bin/true'], {})
self.assertEqual('Test Process', pi.name)
self.assertEqual(['/bin/true'], pi.args)
self.assertEqual({}, pi.env)
@@ -1890,122 +1893,122 @@ class TestBossComponents(unittest.TestCase):
self.assertEqual(42147, pi.pid)
def test_register_process(self):
- '''Test that processes can be registered with BoB.'''
- bob = MockBob()
+ '''Test that processes can be registered with Init.'''
+ init = MockInit()
component = MockComponent('test', 53, 'Test')
- self.assertFalse(53 in bob.components)
- bob.register_process(53, component)
- self.assertTrue(53 in bob.components)
- self.assertEqual(bob.components[53].name(), 'test')
- self.assertEqual(bob.components[53].pid(), 53)
- self.assertEqual(bob.components[53].address(), 'Test')
+ self.assertFalse(53 in init.components)
+ init.register_process(53, component)
+ self.assertTrue(53 in init.components)
+ self.assertEqual(init.components[53].name(), 'test')
+ self.assertEqual(init.components[53].pid(), 53)
+ self.assertEqual(init.components[53].address(), 'Test')
- def _start_simple_helper(self, bob, verbose):
- bob.verbose = verbose
+ def _start_simple_helper(self, init, verbose):
+ init.verbose = verbose
args = ['/bin/true']
if verbose:
args.append('-v')
- bob.start_simple('/bin/true')
- self.assertEqual('/bin/true', bob.started_process_name)
- self.assertEqual(args, bob.started_process_args)
- self.assertEqual({'TESTENV': 'A test string'}, bob.started_process_env)
+ init.start_simple('/bin/true')
+ self.assertEqual('/bin/true', init.started_process_name)
+ self.assertEqual(args, init.started_process_args)
+ self.assertEqual({'TESTENV': 'A test string'}, init.started_process_env)
def test_start_simple(self):
'''Test simple process startup.'''
- bob = MockBobSimple()
- bob.c_channel_env = {'TESTENV': 'A test string'}
+ init = MockInitSimple()
+ init.c_channel_env = {'TESTENV': 'A test string'}
# non-verbose case
- self._start_simple_helper(bob, False)
+ self._start_simple_helper(init, False)
# verbose case
- self._start_simple_helper(bob, True)
+ self._start_simple_helper(init, True)
- def _start_auth_helper(self, bob, verbose):
- bob.verbose = verbose
+ def _start_auth_helper(self, init, verbose):
+ init.verbose = verbose
args = ['b10-auth']
if verbose:
args.append('-v')
- bob.start_auth()
- self.assertEqual('b10-auth', bob.started_process_name)
- self.assertEqual(args, bob.started_process_args)
- self.assertEqual({'FOO': 'an env string'}, bob.started_process_env)
+ init.start_auth()
+ self.assertEqual('b10-auth', init.started_process_name)
+ self.assertEqual(args, init.started_process_args)
+ self.assertEqual({'FOO': 'an env string'}, init.started_process_env)
def test_start_auth(self):
'''Test that b10-auth is started.'''
- bob = MockBobSimple()
- bob.c_channel_env = {'FOO': 'an env string'}
+ init = MockInitSimple()
+ init.c_channel_env = {'FOO': 'an env string'}
# non-verbose case
- self._start_auth_helper(bob, False)
+ self._start_auth_helper(init, False)
# verbose case
- self._start_auth_helper(bob, True)
+ self._start_auth_helper(init, True)
- def _start_resolver_helper(self, bob, verbose):
- bob.verbose = verbose
+ def _start_resolver_helper(self, init, verbose):
+ init.verbose = verbose
args = ['b10-resolver']
if verbose:
args.append('-v')
- bob.start_resolver()
- self.assertEqual('b10-resolver', bob.started_process_name)
- self.assertEqual(args, bob.started_process_args)
- self.assertEqual({'BAR': 'an env string'}, bob.started_process_env)
+ init.start_resolver()
+ self.assertEqual('b10-resolver', init.started_process_name)
+ self.assertEqual(args, init.started_process_args)
+ self.assertEqual({'BAR': 'an env string'}, init.started_process_env)
def test_start_resolver(self):
'''Test that b10-resolver is started.'''
- bob = MockBobSimple()
- bob.c_channel_env = {'BAR': 'an env string'}
+ init = MockInitSimple()
+ init.c_channel_env = {'BAR': 'an env string'}
# non-verbose case
- self._start_resolver_helper(bob, False)
+ self._start_resolver_helper(init, False)
# verbose case
- self._start_resolver_helper(bob, True)
+ self._start_resolver_helper(init, True)
- def _start_cmdctl_helper(self, bob, verbose, port = None):
- bob.verbose = verbose
+ def _start_cmdctl_helper(self, init, verbose, port = None):
+ init.verbose = verbose
args = ['b10-cmdctl']
if port is not None:
- bob.cmdctl_port = port
+ init.cmdctl_port = port
args.append('--port=9353')
if verbose:
args.append('-v')
- bob.start_cmdctl()
- self.assertEqual('b10-cmdctl', bob.started_process_name)
- self.assertEqual(args, bob.started_process_args)
- self.assertEqual({'BAZ': 'an env string'}, bob.started_process_env)
+ init.start_cmdctl()
+ self.assertEqual('b10-cmdctl', init.started_process_name)
+ self.assertEqual(args, init.started_process_args)
+ self.assertEqual({'BAZ': 'an env string'}, init.started_process_env)
def test_start_cmdctl(self):
'''Test that b10-cmdctl is started.'''
- bob = MockBobSimple()
- bob.c_channel_env = {'BAZ': 'an env string'}
+ init = MockInitSimple()
+ init.c_channel_env = {'BAZ': 'an env string'}
# non-verbose case
- self._start_cmdctl_helper(bob, False)
+ self._start_cmdctl_helper(init, False)
# verbose case
- self._start_cmdctl_helper(bob, True)
+ self._start_cmdctl_helper(init, True)
# with port, non-verbose case
- self._start_cmdctl_helper(bob, False, 9353)
+ self._start_cmdctl_helper(init, False, 9353)
# with port, verbose case
- self._start_cmdctl_helper(bob, True, 9353)
+ self._start_cmdctl_helper(init, True, 9353)
def test_socket_data(self):
- '''Test that BoB._socket_data works as expected.'''
+ '''Test that Init._socket_data works as expected.'''
class MockSock:
def __init__(self, fd, throw):
self.fd = fd
@@ -2034,7 +2037,7 @@ class TestBossComponents(unittest.TestCase):
def close(self):
return
- class MockBobSocketData(BoB):
+ class MockInitSocketData(Init):
def __init__(self, throw):
self._unix_sockets = {42: (MockSock(42, throw), b'')}
self.requests = []
@@ -2047,27 +2050,27 @@ class TestBossComponents(unittest.TestCase):
self.dead.append(sock.fd)
# Case where we get data every time we call recv()
- bob = MockBobSocketData(False)
- bob._socket_data(42)
- self.assertEqual(bob.requests,
+ init = MockInitSocketData(False)
+ init._socket_data(42)
+ self.assertEqual(init.requests,
[{42: b'Hello World.'},
{42: b'You are so nice today.'}])
- self.assertEqual(bob.dead, [42])
- self.assertEqual({}, bob._unix_sockets)
+ self.assertEqual(init.dead, [42])
+ self.assertEqual({}, init._unix_sockets)
# Case where socket.recv() raises EAGAIN. In this case, the
# routine is supposed to save what it has back to
- # BoB._unix_sockets.
- bob = MockBobSocketData(True)
- bob._socket_data(42)
- self.assertEqual(bob.requests, [{42: b'Hello World.'}])
- self.assertFalse(bob.dead)
- self.assertEqual(len(bob._unix_sockets), 1)
- self.assertEqual(bob._unix_sockets[42][1], b'You')
+ # Init._unix_sockets.
+ init = MockInitSocketData(True)
+ init._socket_data(42)
+ self.assertEqual(init.requests, [{42: b'Hello World.'}])
+ self.assertFalse(init.dead)
+ self.assertEqual(len(init._unix_sockets), 1)
+ self.assertEqual(init._unix_sockets[42][1], b'You')
def test_startup(self):
- '''Test that BoB.startup() handles failures properly.'''
- class MockBobStartup(BoB):
+ '''Test that Init.startup() handles failures properly.'''
+ class MockInitStartup(Init):
def __init__(self, throw):
self.throw = throw
self.started = False
@@ -2099,58 +2102,59 @@ class TestBossComponents(unittest.TestCase):
# All is well case, where all components are started
# successfully. We check that the actual call to
- # start_all_components() is made, and BoB.runnable is true.
- bob = MockBobStartup(False)
- r = bob.startup()
+ # start_all_components() is made, and Init.runnable is true.
+ b10_init = MockInitStartup(False)
+ r = b10_init.startup()
self.assertIsNone(r)
- self.assertTrue(bob.started)
- self.assertFalse(bob.killed)
- self.assertTrue(bob.runnable)
- self.assertEqual({}, bob.c_channel_env)
+ self.assertTrue(b10_init.started)
+ self.assertFalse(b10_init.killed)
+ self.assertTrue(b10_init.runnable)
+ self.assertEqual({}, b10_init.c_channel_env)
# Case where starting components fails. We check that
# kill_started_components() is called right after, and
- # BoB.runnable is not modified.
- bob = MockBobStartup(True)
- r = bob.startup()
+ # Init.runnable is not modified.
+ b10_init = MockInitStartup(True)
+ r = b10_init.startup()
# r contains an error message
self.assertEqual(r, 'Unable to start myproc: Assume starting components has failed.')
- self.assertTrue(bob.started)
- self.assertTrue(bob.killed)
- self.assertFalse(bob.runnable)
- self.assertEqual({}, bob.c_channel_env)
+ self.assertTrue(b10_init.started)
+ self.assertTrue(b10_init.killed)
+ self.assertFalse(b10_init.runnable)
+ self.assertEqual({}, b10_init.c_channel_env)
# Check if msgq_socket_file is carried over
- bob = MockBobStartup(False)
- bob.msgq_socket_file = 'foo'
- r = bob.startup()
- self.assertEqual({'BIND10_MSGQ_SOCKET_FILE': 'foo'}, bob.c_channel_env)
+ b10_init = MockInitStartup(False)
+ b10_init.msgq_socket_file = 'foo'
+ r = b10_init.startup()
+ self.assertEqual({'BIND10_MSGQ_SOCKET_FILE': 'foo'},
+ b10_init.c_channel_env)
# Check failure of changing user results in a different message
- bob = MockBobStartup(bind10_src.ChangeUserError('failed to chusr'))
- r = bob.startup()
+ b10_init = MockInitStartup(init.ChangeUserError('failed to chusr'))
+ r = b10_init.startup()
self.assertIn('failed to chusr', r)
- self.assertTrue(bob.killed)
+ self.assertTrue(b10_init.killed)
# Check the case when socket file already exists
isc.cc.Session = DummySessionSocketExists
- bob = MockBobStartup(False)
- r = bob.startup()
+ b10_init = MockInitStartup(False)
+ r = b10_init.startup()
self.assertIn('already running', r)
# isc.cc.Session is restored during tearDown().
class SocketSrvTest(unittest.TestCase):
"""
- This tests some methods of boss related to the unix domain sockets used
- to transfer other sockets to applications.
+ This tests some methods of b10-init related to the unix domain sockets
+ used to transfer other sockets to applications.
"""
def setUp(self):
"""
- Create the boss to test, testdata and backup some functions.
+ Create the b10-init to test, testdata and backup some functions.
"""
- self.__boss = BoB()
- self.__select_backup = bind10_src.select.select
+ self.__b10_init = Init()
+ self.__select_backup = init.select.select
self.__select_called = None
self.__socket_data_called = None
self.__consumer_dead_called = None
@@ -2160,7 +2164,7 @@ class SocketSrvTest(unittest.TestCase):
"""
Restore functions.
"""
- bind10_src.select.select = self.__select_backup
+ init.select.select = self.__select_backup
class __FalseSocket:
"""
@@ -2216,24 +2220,24 @@ class SocketSrvTest(unittest.TestCase):
def __accept(self):
"""
- Hijact the accept method of the boss.
+ Hijack the accept method of the b10-init.
- Notes down it was called and stops the boss.
+ Notes down it was called and stops b10-init.
"""
self.__accept_called = True
- self.__boss.runnable = False
+ self.__b10_init.runnable = False
def test_srv_accept_called(self):
"""
- Test that the _srv_accept method of boss is called when the listening
- socket is readable.
+ Test that the _srv_accept method of b10-init is called when the
+ listening socket is readable.
"""
- self.__boss.runnable = True
- self.__boss._srv_socket = self.__FalseSocket(self)
- self.__boss._srv_accept = self.__accept
- self.__boss.ccs = self.__CCS()
- bind10_src.select.select = self.__select_accept
- self.__boss.run(2)
+ self.__b10_init.runnable = True
+ self.__b10_init._srv_socket = self.__FalseSocket(self)
+ self.__b10_init._srv_accept = self.__accept
+ self.__b10_init.ccs = self.__CCS()
+ init.select.select = self.__select_accept
+ self.__b10_init.run(2)
# It called the accept
self.assertTrue(self.__accept_called)
# And the select had the right parameters
@@ -2243,39 +2247,39 @@ class SocketSrvTest(unittest.TestCase):
"""
Test how the _srv_accept method works.
"""
- self.__boss._srv_socket = self.__FalseSocket(self)
- self.__boss._srv_accept()
+ self.__b10_init._srv_socket = self.__FalseSocket(self)
+ self.__b10_init._srv_accept()
# After we accepted, a new socket is added there
- socket = self.__boss._unix_sockets[13][0]
+ socket = self.__b10_init._unix_sockets[13][0]
# The socket is properly stored there
self.assertTrue(isinstance(socket, self.__FalseSocket))
# And the buffer (yet empty) is there
- self.assertEqual({13: (socket, b'')}, self.__boss._unix_sockets)
+ self.assertEqual({13: (socket, b'')}, self.__b10_init._unix_sockets)
def __socket_data(self, socket):
- self.__boss.runnable = False
+ self.__b10_init.runnable = False
self.__socket_data_called = socket
def test_socket_data(self):
"""
Test that a socket that wants attention gets it.
"""
- self.__boss._srv_socket = self.__FalseSocket(self)
- self.__boss._socket_data = self.__socket_data
- self.__boss.ccs = self.__CCS()
- self.__boss._unix_sockets = {13: (self.__FalseSocket(self, 13), b'')}
- self.__boss.runnable = True
- bind10_src.select.select = self.__select_data
- self.__boss.run(2)
+ self.__b10_init._srv_socket = self.__FalseSocket(self)
+ self.__b10_init._socket_data = self.__socket_data
+ self.__b10_init.ccs = self.__CCS()
+ self.__b10_init._unix_sockets = {13: (self.__FalseSocket(self, 13), b'')}
+ self.__b10_init.runnable = True
+ init.select.select = self.__select_data
+ self.__b10_init.run(2)
self.assertEqual(13, self.__socket_data_called)
self.assertEqual(([2, 1, 42, 13], [], [], None), self.__select_called)
def __prepare_data(self, data):
socket = self.__FalseSocket(self, 13)
- self.__boss._unix_sockets = {13: (socket, b'')}
+ self.__b10_init._unix_sockets = {13: (socket, b'')}
socket.data = data
- self.__boss.socket_consumer_dead = self.__consumer_dead
- self.__boss.socket_request_handler = self.__socket_request_handler
+ self.__b10_init.socket_consumer_dead = self.__consumer_dead
+ self.__b10_init.socket_request_handler = self.__socket_request_handler
return socket
def __consumer_dead(self, socket):
@@ -2290,9 +2294,9 @@ class SocketSrvTest(unittest.TestCase):
when it is closed.
"""
socket = self.__prepare_data(None)
- self.__boss._socket_data(13)
+ self.__b10_init._socket_data(13)
self.assertEqual(socket, self.__consumer_dead_called)
- self.assertEqual({}, self.__boss._unix_sockets)
+ self.assertEqual({}, self.__b10_init._unix_sockets)
self.assertTrue(socket.closed)
def test_socket_short(self):
@@ -2301,8 +2305,8 @@ class SocketSrvTest(unittest.TestCase):
kept there, but nothing is called.
"""
socket = self.__prepare_data(b'tok')
- self.__boss._socket_data(13)
- self.assertEqual({13: (socket, b'tok')}, self.__boss._unix_sockets)
+ self.__b10_init._socket_data(13)
+ self.assertEqual({13: (socket, b'tok')}, self.__b10_init._unix_sockets)
self.assertFalse(socket.closed)
self.assertIsNone(self.__consumer_dead_called)
self.assertIsNone(self.__socket_request_handler_called)
@@ -2315,9 +2319,9 @@ class SocketSrvTest(unittest.TestCase):
"""
socket = self.__prepare_data(b"en\nanothe")
# The data to finish
- self.__boss._unix_sockets[13] = (socket, b'tok')
- self.__boss._socket_data(13)
- self.assertEqual({13: (socket, b'anothe')}, self.__boss._unix_sockets)
+ self.__b10_init._unix_sockets[13] = (socket, b'tok')
+ self.__b10_init._socket_data(13)
+ self.assertEqual({13: (socket, b'anothe')}, self.__b10_init._unix_sockets)
self.assertFalse(socket.closed)
self.assertIsNone(self.__consumer_dead_called)
self.assertEqual((b'token', socket),
@@ -2330,9 +2334,9 @@ class SocketSrvTest(unittest.TestCase):
"""
sock = self.__prepare_data(socket.error(errno.ENOMEM,
"There's more memory available, but not for you"))
- self.__boss._socket_data(13)
+ self.__b10_init._socket_data(13)
self.assertEqual(sock, self.__consumer_dead_called)
- self.assertEqual({}, self.__boss._unix_sockets)
+ self.assertEqual({}, self.__b10_init._unix_sockets)
self.assertTrue(sock.closed)
class TestFunctions(unittest.TestCase):
@@ -2342,15 +2346,15 @@ class TestFunctions(unittest.TestCase):
self.assertFalse(os.path.exists(self.lockfile_testpath))
os.mkdir(self.lockfile_testpath)
self.assertTrue(os.path.isdir(self.lockfile_testpath))
- self.__isfile_orig = bind10_src.os.path.isfile
- self.__unlink_orig = bind10_src.os.unlink
+ self.__isfile_orig = init.os.path.isfile
+ self.__unlink_orig = init.os.unlink
def tearDown(self):
os.rmdir(self.lockfile_testpath)
self.assertFalse(os.path.isdir(self.lockfile_testpath))
os.environ["B10_LOCKFILE_DIR_FROM_BUILD"] = "@abs_top_builddir@"
- bind10_src.os.path.isfile = self.__isfile_orig
- bind10_src.os.unlink = self.__unlink_orig
+ init.os.path.isfile = self.__isfile_orig
+ init.os.unlink = self.__unlink_orig
def test_remove_lock_files(self):
os.environ["B10_LOCKFILE_DIR_FROM_BUILD"] = self.lockfile_testpath
@@ -2364,7 +2368,7 @@ class TestFunctions(unittest.TestCase):
self.assertTrue(os.path.isfile(fname))
# first call should clear up all the lockfiles
- bind10_src.remove_lock_files()
+ init.remove_lock_files()
# check if the lockfiles exist
for f in lockfiles:
@@ -2372,7 +2376,7 @@ class TestFunctions(unittest.TestCase):
self.assertFalse(os.path.isfile(fname))
# second call should not assert anyway
- bind10_src.remove_lock_files()
+ init.remove_lock_files()
def test_remove_lock_files_fail(self):
# Permission error on unlink is ignored; other exceptions are really
@@ -2380,40 +2384,40 @@ class TestFunctions(unittest.TestCase):
def __raising_unlink(unused, ex):
raise ex
- bind10_src.os.path.isfile = lambda _: True
+ init.os.path.isfile = lambda _: True
os_error = OSError()
- bind10_src.os.unlink = lambda f: __raising_unlink(f, os_error)
+ init.os.unlink = lambda f: __raising_unlink(f, os_error)
os_error.errno = errno.EPERM
- bind10_src.remove_lock_files() # no disruption
+ init.remove_lock_files() # no disruption
os_error.errno = errno.EACCES
- bind10_src.remove_lock_files() # no disruption
+ init.remove_lock_files() # no disruption
os_error.errno = errno.ENOENT
- self.assertRaises(OSError, bind10_src.remove_lock_files)
+ self.assertRaises(OSError, init.remove_lock_files)
- bind10_src.os.unlink = lambda f: __raising_unlink(f, Exception('bad'))
- self.assertRaises(Exception, bind10_src.remove_lock_files)
+ init.os.unlink = lambda f: __raising_unlink(f, Exception('bad'))
+ self.assertRaises(Exception, init.remove_lock_files)
def test_get_signame(self):
# just test with some samples
- signame = bind10_src.get_signame(signal.SIGTERM)
+ signame = init.get_signame(signal.SIGTERM)
self.assertEqual('SIGTERM', signame)
- signame = bind10_src.get_signame(signal.SIGKILL)
+ signame = init.get_signame(signal.SIGKILL)
self.assertEqual('SIGKILL', signame)
# 59426 is hopefully an unused signal on most platforms
- signame = bind10_src.get_signame(59426)
+ signame = init.get_signame(59426)
self.assertEqual('Unknown signal 59426', signame)
def test_fatal_signal(self):
- self.assertIsNone(bind10_src.boss_of_bind)
- bind10_src.boss_of_bind = BoB()
- bind10_src.boss_of_bind.runnable = True
- bind10_src.fatal_signal(signal.SIGTERM, None)
+ self.assertIsNone(init.b10_init)
+ init.b10_init = Init()
+ init.b10_init.runnable = True
+ init.fatal_signal(signal.SIGTERM, None)
# Now, runnable must be False
- self.assertFalse(bind10_src.boss_of_bind.runnable)
- bind10_src.boss_of_bind = None
+ self.assertFalse(init.b10_init.runnable)
+ init.b10_init = None
if __name__ == '__main__':
# store os.environ for test_unchanged_environment
diff --git a/src/bin/bindctl/bindctl.xml b/src/bin/bindctl/bindctl.xml
index 3993739..b5215f4 100644
--- a/src/bin/bindctl/bindctl.xml
+++ b/src/bin/bindctl/bindctl.xml
@@ -218,7 +218,7 @@
<command>config</command> for Configuration commands.
<!-- TODO: or is config from the cfgmgr module? -->
Additional modules may be available, such as
- <command>Boss</command>, <command>Xfrin</command>, and
+ <command>Init</command>, <command>Xfrin</command>, and
<command>Auth</command>.
</para>
diff --git a/src/bin/bindctl/bindctl_main.py.in b/src/bin/bindctl/bindctl_main.py.in
index 546ecc0..875b06e 100755
--- a/src/bin/bindctl/bindctl_main.py.in
+++ b/src/bin/bindctl/bindctl_main.py.in
@@ -34,7 +34,7 @@ isc.util.process.rename()
# number, and the overall BIND 10 version number (set in configure.ac).
VERSION = "bindctl 20110217 (BIND 10 @PACKAGE_VERSION@)"
-DEFAULT_IDENTIFIER_DESC = "The identifier specifies the config item. Child elements are separated with the '/' character. List indices can be specified with '[i]', where i is an integer specifying the index, starting with 0. Examples: 'Boss/start_auth', 'Recurse/listen_on[0]/address'. If no identifier is given, shows the item at the current location."
+DEFAULT_IDENTIFIER_DESC = "The identifier specifies the config item. Child elements are separated with the '/' character. List indices can be specified with '[i]', where i is an integer specifying the index, starting with 0. Examples: 'Init/start_auth', 'Auth/listen_on[0]/address'. If no identifier is given, shows the item at the current location."
def prepare_config_commands(tool):
'''Prepare fixed commands for local configuration editing'''
diff --git a/src/bin/bindctl/command_sets.py b/src/bin/bindctl/command_sets.py
index c001ec8..b146c38 100644
--- a/src/bin/bindctl/command_sets.py
+++ b/src/bin/bindctl/command_sets.py
@@ -35,21 +35,21 @@ command_sets = {
'commands':
[
'!echo adding Authoritative server component',
- 'config add /Boss/components b10-auth',
- 'config set /Boss/components/b10-auth/kind needed',
- 'config set /Boss/components/b10-auth/special auth',
+ 'config add /Init/components b10-auth',
+ 'config set /Init/components/b10-auth/kind needed',
+ 'config set /Init/components/b10-auth/special auth',
'!echo adding Xfrin component',
- 'config add /Boss/components b10-xfrin',
- 'config set /Boss/components/b10-xfrin/address Xfrin',
- 'config set /Boss/components/b10-xfrin/kind dispensable',
+ 'config add /Init/components b10-xfrin',
+ 'config set /Init/components/b10-xfrin/address Xfrin',
+ 'config set /Init/components/b10-xfrin/kind dispensable',
'!echo adding Xfrout component',
- 'config add /Boss/components b10-xfrout',
- 'config set /Boss/components/b10-xfrout/address Xfrout',
- 'config set /Boss/components/b10-xfrout/kind dispensable',
+ 'config add /Init/components b10-xfrout',
+ 'config set /Init/components/b10-xfrout/address Xfrout',
+ 'config set /Init/components/b10-xfrout/kind dispensable',
'!echo adding Zone Manager component',
- 'config add /Boss/components b10-zonemgr',
- 'config set /Boss/components/b10-zonemgr/address Zonemgr',
- 'config set /Boss/components/b10-zonemgr/kind dispensable',
+ 'config add /Init/components b10-zonemgr',
+ 'config set /Init/components/b10-zonemgr/address Zonemgr',
+ 'config set /Init/components/b10-zonemgr/kind dispensable',
'!echo Components added. Please enter "config commit" to',
'!echo finalize initial setup and run the components.'
]
diff --git a/src/bin/cfgmgr/b10-cfgmgr.py.in b/src/bin/cfgmgr/b10-cfgmgr.py.in
index 315e3c5..06b9b0f 100755
--- a/src/bin/cfgmgr/b10-cfgmgr.py.in
+++ b/src/bin/cfgmgr/b10-cfgmgr.py.in
@@ -115,7 +115,7 @@ def main():
cm.read_config()
for ppath in PLUGIN_PATHS:
load_plugins(ppath, cm)
- cm.notify_boss()
+ cm.notify_b10_init()
cm.run()
except SessionError as se:
logger.fatal(CFGMGR_CC_SESSION_ERROR, se)
diff --git a/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in b/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in
index 351e8bf..02b48bd 100644
--- a/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in
+++ b/src/bin/cfgmgr/tests/b10-cfgmgr_test.py.in
@@ -27,7 +27,7 @@ class MyConfigManager:
def __init__(self, path, filename, session=None, rename_config_file=False):
self._path = path
self.read_config_called = False
- self.notify_boss_called = False
+ self.notify_b10_init_called = False
self.run_called = False
self.write_config_called = False
self.rename_config_called = False
@@ -37,8 +37,8 @@ class MyConfigManager:
def read_config(self):
self.read_config_called = True
- def notify_boss(self):
- self.notify_boss_called = True
+ def notify_b10_init(self):
+ self.notify_b10_init_called = True
def run(self):
self.run_called = True
@@ -89,7 +89,7 @@ class TestConfigManagerStartup(unittest.TestCase):
b.load_plugins = orig_load
self.assertTrue(b.cm.read_config_called)
- self.assertTrue(b.cm.notify_boss_called)
+ self.assertTrue(b.cm.notify_b10_init_called)
self.assertTrue(b.cm.run_called)
self.assertTrue(self.loaded_plugins)
# if there are no changes, config is not written
diff --git a/src/bin/cmdctl/b10-cmdctl.xml b/src/bin/cmdctl/b10-cmdctl.xml
index 4b1b32f..4d315ac 100644
--- a/src/bin/cmdctl/b10-cmdctl.xml
+++ b/src/bin/cmdctl/b10-cmdctl.xml
@@ -78,7 +78,7 @@
<refsect1>
<title>OPTIONS</title>
-
+
<para>The arguments are as follows:</para>
<variablelist>
@@ -175,7 +175,7 @@
<command>shutdown</command> exits <command>b10-cmdctl</command>.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the b10-init process may restart this service
if configured.)
</para>
diff --git a/src/bin/cmdctl/cmdctl.py.in b/src/bin/cmdctl/cmdctl.py.in
index b026612..b354f76 100755
--- a/src/bin/cmdctl/cmdctl.py.in
+++ b/src/bin/cmdctl/cmdctl.py.in
@@ -339,7 +339,7 @@ class CommandControl():
self.modules_spec[args[0]] = args[1]
elif command == ccsession.COMMAND_SHUTDOWN:
- #When cmdctl get 'shutdown' command from boss,
+ #When cmdctl get 'shutdown' command from b10-init,
#shutdown the outer httpserver.
self._module_cc.send_stopping()
self._httpserver.shutdown()
diff --git a/src/bin/ddns/b10-ddns.xml b/src/bin/ddns/b10-ddns.xml
index fb895b9..7935482 100644
--- a/src/bin/ddns/b10-ddns.xml
+++ b/src/bin/ddns/b10-ddns.xml
@@ -56,8 +56,8 @@
<para>The <command>b10-ddns</command> daemon provides the BIND 10
Dynamic Update (DDNS) service, as specified in RFC 2136.
Normally it is started by the
- <citerefentry><refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- boss process.
+ <citerefentry><refentrytitle>b10-init</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ process.
</para>
<para>
@@ -119,7 +119,7 @@
<listitem>
<para>
This value is ignored at this moment, but is provided for
- compatibility with the <command>bind10</command> Boss process.
+ compatibility with the <command>b10-init</command> process.
</para>
</listitem>
</varlistentry>
@@ -154,7 +154,7 @@
<command>shutdown</command> exits <command>b10-ddns</command>.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the b10-init process may restart this service
if configured.)
</para>
diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.h b/src/bin/dhcp4/ctrl_dhcp4_srv.h
index ab4d45a..ac15c44 100644
--- a/src/bin/dhcp4/ctrl_dhcp4_srv.h
+++ b/src/bin/dhcp4/ctrl_dhcp4_srv.h
@@ -49,7 +49,7 @@ public:
/// @brief Establishes msgq session.
///
/// Creates session that will be used to receive commands and updated
- /// configuration from boss (or indirectly from user via bindctl).
+ /// configuration from cfgmgr (or indirectly from user via bindctl).
void establishSession();
/// @brief Terminates existing msgq session.
diff --git a/src/bin/dhcp4/tests/dhcp4_test.py b/src/bin/dhcp4/tests/dhcp4_test.py
index e493e04..276456e 100644
--- a/src/bin/dhcp4/tests/dhcp4_test.py
+++ b/src/bin/dhcp4/tests/dhcp4_test.py
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from bind10_src import ProcessInfo, parse_args, dump_pid, unlink_pid_file, _BASETIME
+from init import ProcessInfo, parse_args, dump_pid, unlink_pid_file, _BASETIME
import unittest
import sys
diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.h b/src/bin/dhcp6/ctrl_dhcp6_srv.h
index e3452bb..0e699ce 100644
--- a/src/bin/dhcp6/ctrl_dhcp6_srv.h
+++ b/src/bin/dhcp6/ctrl_dhcp6_srv.h
@@ -49,7 +49,7 @@ public:
/// @brief Establishes msgq session.
///
/// Creates session that will be used to receive commands and updated
- /// configuration from boss (or indirectly from user via bindctl).
+ /// configuration from cfgmgr (or indirectly from user via bindctl).
void establishSession();
/// @brief Terminates existing msgq session.
diff --git a/src/bin/dhcp6/tests/dhcp6_test.py b/src/bin/dhcp6/tests/dhcp6_test.py
index 1870392..3333111 100644
--- a/src/bin/dhcp6/tests/dhcp6_test.py
+++ b/src/bin/dhcp6/tests/dhcp6_test.py
@@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-from bind10_src import ProcessInfo, parse_args, dump_pid, unlink_pid_file, _BASETIME
+from init import ProcessInfo, parse_args, dump_pid, unlink_pid_file, _BASETIME
import unittest
import sys
@@ -157,7 +157,7 @@ class TestDhcpv6Daemon(unittest.TestCase):
def test_alive(self):
"""
- Simple test. Checks that b10-dhcp6 can be started and prints out info
+ Simple test. Checks that b10-dhcp6 can be started and prints out info
about starting DHCPv6 operation.
"""
print("Note: Purpose of some of the tests is to check if DHCPv6 server can be started,")
diff --git a/src/bin/resolver/b10-resolver.xml b/src/bin/resolver/b10-resolver.xml
index 485d022..ae73c3d 100644
--- a/src/bin/resolver/b10-resolver.xml
+++ b/src/bin/resolver/b10-resolver.xml
@@ -52,8 +52,8 @@
<title>DESCRIPTION</title>
<para>The <command>b10-resolver</command> daemon provides the BIND 10
recursive DNS server. Normally it is started by the
- <citerefentry><refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- boss process.
+ <citerefentry><refentrytitle>b10-init</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ process.
</para>
<para>
@@ -205,7 +205,7 @@ once that is merged you can for instance do 'config add Resolver/forward_address
<command>shutdown</command> exits <command>b10-resolver</command>.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the b10-init process may restart this service
if configured.)
</para>
diff --git a/src/bin/stats/b10-stats-httpd.xml b/src/bin/stats/b10-stats-httpd.xml
index 28d6ac9..be91737 100644
--- a/src/bin/stats/b10-stats-httpd.xml
+++ b/src/bin/stats/b10-stats-httpd.xml
@@ -54,7 +54,7 @@
intended for HTTP/XML interface for statistics module. This server
process runs as a process separated from the process of the BIND 10 Stats
daemon (<command>b10-stats</command>). The server is initially executed
- by the BIND 10 boss process (<command>bind10</command>) and eventually
+ by the b10-init process and eventually
exited by it. The server is intended to serve requests by HTTP
clients like web browsers and third-party modules. When the server is
asked, it requests BIND 10 statistics data or its schema from
@@ -74,7 +74,7 @@
10 statistics. The server uses CC session in communication
with <command>b10-stats</command>. CC session is provided
by <command>b10-msgq</command> which is started
- by <command>bind10</command> in advance. The server is implemented by
+ by <command>b10-init</command> in advance. The server is implemented by
HTTP-server libraries included in Python 3. The server obtains the
configuration from the config manager (<command>b10-cfgmgr</command>) in
runtime. Please see below for more details about this spec file and
@@ -176,7 +176,7 @@
exits the <command>b10-stats-httpd</command> process.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the b10-init process may restart this service
if configured.)
</para>
</listitem>
diff --git a/src/bin/stats/b10-stats.xml b/src/bin/stats/b10-stats.xml
index ee89ad2..bbdb96e 100644
--- a/src/bin/stats/b10-stats.xml
+++ b/src/bin/stats/b10-stats.xml
@@ -56,18 +56,18 @@
from each BIND 10 module. Its statistics information may be
reported via <command>bindctl</command> or
<command>b10-stats-httpd</command>. It is started by
- <command>bind10</command> and communicates by using the
+ <command>b10-init</command> and communicates by using the
Command Channel by <command>b10-msgq</command> with other
- modules like <command>bind10</command>, <command>b10-auth</command>
+ modules like <command>b10-init</command>, <command>b10-auth</command>
and so on. <command>b10-stats</command> periodically requests statistics
data from each module. The interval time can be configured
via <command>bindctl</command>. <command>b10-stats</command> cannot
accept any command from other modules for updating statistics data. The
stats module collects data and
aggregates it. <command>b10-stats</command> invokes an internal
- command for <command>bind10</command> after its initial
+ command for <command>b10-init</command> after its initial
starting to make sure it collects statistics data from
- <command>bind10</command>.
+ <command>b10-init</command>.
</para>
</refsect1>
@@ -131,7 +131,7 @@
<command>b10-stats</command> process.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the b10-init process may restart this service
if configured.)
</para>
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index 7123c53..92fa99a 100755
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -249,17 +249,17 @@ class Stats:
# It counts the number of instances of same module by
# examining the third value from the array result of
- # 'show_processes' of Boss
+ # 'show_processes' of Init
seq = self.cc_session.group_sendmsg(
isc.config.ccsession.create_command("show_processes"),
- 'Boss')
+ 'Init')
(answer, env) = self.cc_session.group_recvmsg(False, seq)
modules = []
if answer:
(rcode, value) = isc.config.ccsession.parse_answer(answer)
if rcode == 0 and type(value) is list:
# NOTE: For example, the "show_processes" command
- # of Boss is assumed to return the response in this
+ # of Init is assumed to return the response in this
# format:
# [
# ...
diff --git a/src/bin/stats/stats.spec b/src/bin/stats/stats.spec
index 6fbf7bb..dab10a2 100644
--- a/src/bin/stats/stats.spec
+++ b/src/bin/stats/stats.spec
@@ -92,7 +92,7 @@
"item_optional": false,
"item_default": "1970-01-01T00:00:00Z",
"item_title": "Last update time",
- "item_description": "The latest date time when the stats module receives from other modules like auth server or boss process and so on",
+ "item_description": "The latest date time when the stats module receives from other modules like auth server or b10-init process and so on",
"item_format": "date-time"
},
{
diff --git a/src/bin/stats/tests/b10-stats-httpd_test.py b/src/bin/stats/tests/b10-stats-httpd_test.py
index fb0510a..98689c8 100644
--- a/src/bin/stats/tests/b10-stats-httpd_test.py
+++ b/src/bin/stats/tests/b10-stats-httpd_test.py
@@ -68,7 +68,7 @@ XMLNS_XSD = "http://www.w3.org/2001/XMLSchema"
XMLNS_XSI = stats_httpd.XMLNS_XSI
DUMMY_DATA = {
- 'Boss' : {
+ 'Init' : {
"boot_time": time.strftime('%Y-%m-%dT%H:%M:%SZ', CONST_BASETIME)
},
'Auth' : {
@@ -278,7 +278,7 @@ class TestHttpHandler(unittest.TestCase):
+ stats_httpd.XSD_URL_PATH)
# check the path of XSL
self.assertTrue(xsl_doctype.startswith(
- '<?xml-stylesheet type="text/xsl" href="' +
+ '<?xml-stylesheet type="text/xsl" href="' +
stats_httpd.XSL_URL_PATH
+ '"?>'))
# check whether the list of 'identifier' attributes in
@@ -397,7 +397,7 @@ class TestHttpHandler(unittest.TestCase):
# 404 NotFound (too long path)
self.client._http_vsn_str = 'HTTP/1.0'
- self.client.putrequest('GET', stats_httpd.XML_URL_PATH + '/Boss/boot_time/a')
+ self.client.putrequest('GET', stats_httpd.XML_URL_PATH + '/Init/boot_time/a')
self.client.endheaders()
response = self.client.getresponse()
self.assertEqual(response.status, 404)
@@ -1001,7 +1001,7 @@ class TestStatsHttpd(unittest.TestCase):
self.assertFalse('item_format' in spec)
self.assertFalse('format' in stats_xml[i].attrib)
- @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
+ @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
def test_xsd_handler(self):
self.stats_httpd = MyStatsHttpd(get_availaddr())
xsd_string = self.stats_httpd.xsd_handler()
@@ -1036,7 +1036,7 @@ class TestStatsHttpd(unittest.TestCase):
self.assertEqual(attribs[i][1], stats_xsd[i].attrib['type'])
self.assertEqual(attribs[i][2], stats_xsd[i].attrib['use'])
- @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
+ @unittest.skipUnless(xml_parser, "skipping the test using XMLParser")
def test_xsl_handler(self):
self.stats_httpd = MyStatsHttpd(get_availaddr())
xsl_string = self.stats_httpd.xsl_handler()
diff --git a/src/bin/stats/tests/b10-stats_test.py b/src/bin/stats/tests/b10-stats_test.py
index d18abf1..80bd3a6 100644
--- a/src/bin/stats/tests/b10-stats_test.py
+++ b/src/bin/stats/tests/b10-stats_test.py
@@ -319,15 +319,15 @@ class TestStats(unittest.TestCase):
self.assertEqual(
send_command(
'show', 'Stats',
- params={ 'owner' : 'Boss',
+ params={ 'owner' : 'Init',
'name' : 'boot_time' }),
- (0, {'Boss': {'boot_time': self.const_datetime}}))
+ (0, {'Init': {'boot_time': self.const_datetime}}))
self.assertEqual(
send_command(
'show', 'Stats',
- params={ 'owner' : 'Boss',
+ params={ 'owner' : 'Init',
'name' : 'boot_time' }),
- (0, {'Boss': {'boot_time': self.const_datetime}}))
+ (0, {'Init': {'boot_time': self.const_datetime}}))
self.assertEqual(
send_command('status', 'Stats'),
(0, "Stats is up. (PID " + str(os.getpid()) + ")"))
@@ -335,13 +335,13 @@ class TestStats(unittest.TestCase):
(rcode, value) = send_command('show', 'Stats')
self.assertEqual(rcode, 0)
self.assertEqual(len(value), 3)
- self.assertTrue('Boss' in value)
+ self.assertTrue('Init' in value)
self.assertTrue('Stats' in value)
self.assertTrue('Auth' in value)
self.assertEqual(len(value['Stats']), 5)
- self.assertEqual(len(value['Boss']), 1)
- self.assertTrue('boot_time' in value['Boss'])
- self.assertEqual(value['Boss']['boot_time'], self.const_datetime)
+ self.assertEqual(len(value['Init']), 1)
+ self.assertTrue('boot_time' in value['Init'])
+ self.assertEqual(value['Init']['boot_time'], self.const_datetime)
self.assertTrue('report_time' in value['Stats'])
self.assertTrue('boot_time' in value['Stats'])
self.assertTrue('last_update_time' in value['Stats'])
@@ -350,12 +350,12 @@ class TestStats(unittest.TestCase):
(rcode, value) = send_command('showschema', 'Stats')
self.assertEqual(rcode, 0)
self.assertEqual(len(value), 3)
- self.assertTrue('Boss' in value)
+ self.assertTrue('Init' in value)
self.assertTrue('Stats' in value)
self.assertTrue('Auth' in value)
self.assertEqual(len(value['Stats']), 5)
- self.assertEqual(len(value['Boss']), 1)
- for item in value['Boss']:
+ self.assertEqual(len(value['Init']), 1)
+ for item in value['Init']:
self.assertTrue(len(item) == 7)
self.assertTrue('item_name' in item)
self.assertTrue('item_type' in item)
@@ -383,10 +383,10 @@ class TestStats(unittest.TestCase):
def test_update_modules(self):
self.stats = stats.Stats()
- self.assertEqual(len(self.stats.modules), 3) # Auth, Boss, Stats
+ self.assertEqual(len(self.stats.modules), 3) # Auth, Init, Stats
self.stats.update_modules()
self.assertTrue('Stats' in self.stats.modules)
- self.assertTrue('Boss' in self.stats.modules)
+ self.assertTrue('Init' in self.stats.modules)
self.assertFalse('Dummy' in self.stats.modules)
my_statistics_data = stats.get_spec_defaults(self.stats.modules['Stats'].get_statistics_spec())
self.assertTrue('report_time' in my_statistics_data)
@@ -399,7 +399,7 @@ class TestStats(unittest.TestCase):
self.assertEqual(my_statistics_data['last_update_time'], self.const_default_datetime)
self.assertEqual(my_statistics_data['timestamp'], 0.0)
self.assertEqual(my_statistics_data['lname'], "")
- my_statistics_data = stats.get_spec_defaults(self.stats.modules['Boss'].get_statistics_spec())
+ my_statistics_data = stats.get_spec_defaults(self.stats.modules['Init'].get_statistics_spec())
self.assertTrue('boot_time' in my_statistics_data)
self.assertEqual(my_statistics_data['boot_time'], self.const_default_datetime)
orig_parse_answer = stats.isc.config.ccsession.parse_answer
@@ -411,8 +411,8 @@ class TestStats(unittest.TestCase):
self.stats = stats.Stats()
my_statistics_data = self.stats.get_statistics_data()
self.assertTrue('Stats' in my_statistics_data)
- self.assertTrue('Boss' in my_statistics_data)
- self.assertTrue('boot_time' in my_statistics_data['Boss'])
+ self.assertTrue('Init' in my_statistics_data)
+ self.assertTrue('boot_time' in my_statistics_data['Init'])
my_statistics_data = self.stats.get_statistics_data(owner='Stats')
self.assertTrue('Stats' in my_statistics_data)
self.assertTrue('report_time' in my_statistics_data['Stats'])
@@ -601,7 +601,7 @@ class TestStats(unittest.TestCase):
['foo1']['nds_queries.perzone'],\
_new_val)
self.assertEqual(self.stats.update_statistics_data(
- 'Boss', 'bar1', _test_exp7), ["KeyError: 'foo'"])
+ 'Init', 'bar1', _test_exp7), ["KeyError: 'foo'"])
self.assertEqual(self.stats.update_statistics_data(
'Foo', 'foo1', _test_exp6), ['unknown module name: Foo'])
@@ -659,7 +659,7 @@ class TestStats(unittest.TestCase):
self.assertEqual(self.stats.statistics_data['Auth']['queries.udp'], sum_qudp)
self.assertTrue('Auth' in self.stats.statistics_data_bymid)
# restore statistics data of killed auth
- # self.base.boss.server.pid_list = [ killed ] + self.base.boss.server.pid_list[:]
+ # self.base.b10_init.server.pid_list = [ killed ] + self.base.b10_init.server.pid_list[:]
self.stats.update_statistics_data('Auth',
"bar1 at foo",
{'queries.tcp': bar1_tcp})
@@ -717,9 +717,9 @@ class TestStats(unittest.TestCase):
self.assertEqual(
send_command(
'show', 'Stats',
- params={ 'owner' : 'Boss',
+ params={ 'owner' : 'Init',
'name' : 'boot_time' }),
- (0, {'Boss': {'boot_time': self.const_datetime}}))
+ (0, {'Init': {'boot_time': self.const_datetime}}))
stats_server.shutdown()
def test_commands(self):
@@ -833,7 +833,7 @@ class TestStats(unittest.TestCase):
self.assertEqual(rcode, 0)
self.assertEqual(len(value), 3)
self.assertTrue('Stats' in value)
- self.assertTrue('Boss' in value)
+ self.assertTrue('Init' in value)
self.assertTrue('Auth' in value)
self.assertFalse('__Dummy__' in value)
schema = value['Stats']
@@ -849,7 +849,7 @@ class TestStats(unittest.TestCase):
if len(item) == 7:
self.assertTrue('item_format' in item)
- schema = value['Boss']
+ schema = value['Init']
self.assertEqual(len(schema), 1)
for item in schema:
self.assertTrue(len(item) == 7)
@@ -879,7 +879,7 @@ class TestStats(unittest.TestCase):
self.stats.command_showschema(owner='Stats'))
self.assertEqual(rcode, 0)
self.assertTrue('Stats' in value)
- self.assertFalse('Boss' in value)
+ self.assertFalse('Init' in value)
self.assertFalse('Auth' in value)
for item in value['Stats']:
self.assertTrue(len(item) == 6 or len(item) == 7)
@@ -896,7 +896,7 @@ class TestStats(unittest.TestCase):
self.stats.command_showschema(owner='Stats', name='report_time'))
self.assertEqual(rcode, 0)
self.assertTrue('Stats' in value)
- self.assertFalse('Boss' in value)
+ self.assertFalse('Init' in value)
self.assertFalse('Auth' in value)
self.assertEqual(len(value['Stats'][0]), 7)
self.assertTrue('item_name' in value['Stats'][0])
@@ -1150,15 +1150,15 @@ class TestStats(unittest.TestCase):
self.assertEqual(
send_command('show', 'Stats'),
(0, stat.statistics_data))
- # check statistics data of 'Boss'
- boss = self.base.boss.server
+ # check statistics data of 'Init'
+ b10_init = self.base.b10_init.server
self.assertEqual(
- stat.statistics_data_bymid['Boss'][boss.cc_session.lname],
+ stat.statistics_data_bymid['Init'][b10_init.cc_session.lname],
{'boot_time': self.const_datetime})
self.assertEqual(
- len(stat.statistics_data_bymid['Boss']), 1)
+ len(stat.statistics_data_bymid['Init']), 1)
self.assertEqual(
- stat.statistics_data['Boss'],
+ stat.statistics_data['Init'],
{'boot_time': self.const_datetime})
# check statistics data of each 'Auth' instances
list_auth = ['', '2']
@@ -1219,17 +1219,17 @@ class TestStats(unittest.TestCase):
def test_polling2(self):
# set invalid statistics
- boss = self.base.boss.server
- boss.statistics_data = {'boot_time':1}
+ b10_init = self.base.b10_init.server
+ b10_init.statistics_data = {'boot_time':1}
stats_server = ThreadingServerManager(MyStats)
stat = stats_server.server
stats_server.run()
self.assertEqual(
send_command('status', 'Stats'),
(0, "Stats is up. (PID " + str(os.getpid()) + ")"))
- # check default statistics data of 'Boss'
+ # check default statistics data of 'Init'
self.assertEqual(
- stat.statistics_data['Boss'],
+ stat.statistics_data['Init'],
{'boot_time': self.const_default_datetime})
stats_server.shutdown()
diff --git a/src/bin/stats/tests/test_utils.py b/src/bin/stats/tests/test_utils.py
index 5c1855a..1c5cc3c 100644
--- a/src/bin/stats/tests/test_utils.py
+++ b/src/bin/stats/tests/test_utils.py
@@ -140,11 +140,11 @@ class MockCfgmgr:
def shutdown(self):
self.cfgmgr.running = False
-class MockBoss:
+class MockInit:
spec_str = """\
{
"module_spec": {
- "module_name": "Boss",
+ "module_name": "Init",
"module_description": "Mock Master process",
"config_data": [
{
@@ -210,7 +210,7 @@ class MockBoss:
},
{
"command_name": "ping",
- "command_description": "Ping the boss process",
+ "command_description": "Ping the b10-init process",
"command_args": []
},
{
@@ -537,9 +537,9 @@ class BaseModules:
# MockCfgmgr
self.cfgmgr = ThreadingServerManager(MockCfgmgr)
self.cfgmgr.run()
- # MockBoss
- self.boss = ThreadingServerManager(MockBoss)
- self.boss.run()
+ # MockInit
+ self.b10_init = ThreadingServerManager(MockInit)
+ self.b10_init.run()
# MockAuth
self.auth = ThreadingServerManager(MockAuth)
self.auth.run()
@@ -558,8 +558,8 @@ class BaseModules:
# MockAuth
self.auth2.shutdown(True)
self.auth.shutdown(True)
- # MockBoss
- self.boss.shutdown(True)
+ # MockInit
+ self.b10_init.shutdown(True)
# MockCfgmgr
self.cfgmgr.shutdown(True)
# remove the unused socket file
diff --git a/src/bin/stats/tests/testdata/b10-config.db b/src/bin/stats/tests/testdata/b10-config.db
index 2f89b98..7dd9daf 100644
--- a/src/bin/stats/tests/testdata/b10-config.db
+++ b/src/bin/stats/tests/testdata/b10-config.db
@@ -1,5 +1,5 @@
{ "version": 2,
- "Boss": {
+ "Init": {
"components": {
"b10-auth": {
"kind": "needed",
diff --git a/src/bin/tests/process_rename_test.py.in b/src/bin/tests/process_rename_test.py.in
index 055ebdc..ea8ad87 100644
--- a/src/bin/tests/process_rename_test.py.in
+++ b/src/bin/tests/process_rename_test.py.in
@@ -42,7 +42,7 @@ class TestRename(unittest.TestCase):
# Scripts named in this list are not expected to be renamed and
# should be excluded from the scan.
- EXCLUDED_SCRIPTS = ['isc-sysinfo']
+ EXCLUDED_SCRIPTS = ['isc-sysinfo', 'bind10']
# Regexp to find all the *_SCRIPTS = something lines (except for
# noinst_SCRIPTS, which are scripts for tests), including line
diff --git a/src/bin/xfrin/b10-xfrin.xml b/src/bin/xfrin/b10-xfrin.xml
index eb16ab3..0f3e99c 100644
--- a/src/bin/xfrin/b10-xfrin.xml
+++ b/src/bin/xfrin/b10-xfrin.xml
@@ -56,8 +56,8 @@
<para>The <command>b10-xfrin</command> daemon provides the BIND 10
incoming DNS zone transfer service.
Normally it is started by the
- <citerefentry><refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- boss process.
+ <citerefentry><refentrytitle>b10-init</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ process.
When triggered it can request and receive a zone transfer and store
the zone in a BIND 10 zone data source.
</para>
@@ -180,8 +180,8 @@ in separate zonemgr process.
<para>
<command>shutdown</command> stops all incoming zone transfers
- and exits <command>b10-xfrin</command>. (Note that the BIND 10
- boss process will restart this service.)
+ and exits <command>b10-xfrin</command>. (Note that the
+ b10-init process will restart this service.)
</para>
<!-- TODO:
add a usage example of xfrin -->
diff --git a/src/bin/xfrout/b10-xfrout.xml b/src/bin/xfrout/b10-xfrout.xml
index 8b616d2..0790f98 100644
--- a/src/bin/xfrout/b10-xfrout.xml
+++ b/src/bin/xfrout/b10-xfrout.xml
@@ -55,8 +55,8 @@
outgoing DNS zone transfer service using AXFR or IXFR.
It is also used to send outgoing NOTIFY messages.
Normally it is started by the
- <citerefentry><refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- boss process.
+ <citerefentry><refentrytitle>b10-init</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ process.
When the <command>b10-auth</command> DNS server receives
a transfer request, <command>b10-xfrout</command> sends the
zone as found in the BIND 10 zone data store.
@@ -147,7 +147,7 @@
and exits <command>b10-xfrout</command>.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the BIND 10 b10-init process may restart this service
if configured.)
</para>
diff --git a/src/bin/zonemgr/b10-zonemgr.xml b/src/bin/zonemgr/b10-zonemgr.xml
index f859d23..91cdfc2 100644
--- a/src/bin/zonemgr/b10-zonemgr.xml
+++ b/src/bin/zonemgr/b10-zonemgr.xml
@@ -55,8 +55,8 @@
as the BIND 10 secondary manager, keeps track of timers
and other information necessary for BIND 10 to act as a DNS slave.
Normally it is started by the
- <citerefentry><refentrytitle>bind10</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- boss process.
+ <citerefentry><refentrytitle>b10-init</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ process.
</para>
<para>
@@ -74,7 +74,7 @@
<!--
- self._send_command(XFRIN_MODULE_NAME, ZONE_NOTIFY_COMMAND, param)
+ self._send_command(XFRIN_MODULE_NAME, ZONE_NOTIFY_COMMAND, param)
self._clear_zone_notifier_master(zone_name_class)
# Send refresh command to xfrin module
else:
@@ -188,7 +188,7 @@
<command>shutdown</command> exits <command>b10-zonemgr</command>.
This has an optional <varname>pid</varname> argument to
select the process ID to stop.
- (Note that the BIND 10 boss process may restart this service
+ (Note that the b10-init process may restart this service
if configured.)
</para>
diff --git a/src/bin/zonemgr/zonemgr.py.in b/src/bin/zonemgr/zonemgr.py.in
index 0412e3f..387f095 100755
--- a/src/bin/zonemgr/zonemgr.py.in
+++ b/src/bin/zonemgr/zonemgr.py.in
@@ -625,7 +625,7 @@ class Zonemgr:
ZONE_NOTIFY_COMMAND is issued by Auth process;
ZONE_NEW_DATA_READY_CMD and ZONE_XFRIN_FAILED are issued by
Xfrin process;
- shutdown is issued by a user or Boss process. """
+ shutdown is issued by a user or Init process. """
answer = create_answer(0)
if command == ZONE_NOTIFY_COMMAND:
""" Handle Auth notify command"""
diff --git a/src/bin/zonemgr/zonemgr_messages.mes b/src/bin/zonemgr/zonemgr_messages.mes
index 4f58271..b38db2b 100644
--- a/src/bin/zonemgr/zonemgr_messages.mes
+++ b/src/bin/zonemgr/zonemgr_messages.mes
@@ -69,7 +69,7 @@ new data.
% ZONEMGR_RECEIVE_SHUTDOWN received SHUTDOWN command
This is a debug message indicating that the zone manager has received
-a SHUTDOWN command over the command channel from the Boss process.
+a SHUTDOWN command over the command channel from the Init process.
It will act on this command and shut down.
% ZONEMGR_RECEIVE_UNKNOWN received unknown command '%1'
diff --git a/src/lib/python/bind10_config.py.in b/src/lib/python/bind10_config.py.in
index 6db64e2..9cd8d66 100644
--- a/src/lib/python/bind10_config.py.in
+++ b/src/lib/python/bind10_config.py.in
@@ -43,8 +43,8 @@ def reload():
# the system.
# PLUGIN_PATHS: configuration modules that are not associated to specific
# process
- # LIBEXECPATH: Paths to programs invoked by the boss process
- # The boss process (directly or via a helper module) uses this as
+ # LIBEXECPATH: Paths to programs invoked by the b10-init process
+ # The b10-init process (directly or via a helper module) uses this as
# the prefererred PATH before starting a child process.
# When "FROM_SOURCE", it lists the directories where the programs are
# built so that when BIND 10 is experimentally started on the source
@@ -53,7 +53,7 @@ def reload():
# B10_FROM_SOURCE_LOCALSTATEDIR is specifically intended to be used for
# tests where we want to use various types of configuration within the test
# environment. (We may want to make it even more generic so that the path
- # is passed from the boss process)
+ # is passed from the b10-init process)
if "B10_FROM_SOURCE" in os.environ:
if "B10_FROM_SOURCE_LOCALSTATEDIR" in os.environ:
DATA_PATH = os.environ["B10_FROM_SOURCE_LOCALSTATEDIR"]
diff --git a/src/lib/python/isc/bind10/component.py b/src/lib/python/isc/bind10/component.py
index febeb10..2efb376 100644
--- a/src/lib/python/isc/bind10/component.py
+++ b/src/lib/python/isc/bind10/component.py
@@ -28,12 +28,12 @@ configuration). This is yet to be designed.
"""
import isc.log
-from isc.log_messages.bind10_messages import *
+from isc.log_messages.init_messages import *
import time
import os
import signal
-logger = isc.log.Logger("boss")
+logger = isc.log.Logger("init")
DBG_TRACE_DATA = 20
DBG_TRACE_DETAILED = 80
@@ -96,13 +96,13 @@ class BaseComponent:
that is already shutting down, impossible to stop, etc. We need to add more
states in future to handle it properly.
"""
- def __init__(self, boss, kind):
+ def __init__(self, b10_init, kind):
"""
Creates the component in not running mode.
The parameters are:
- - `boss` the boss object to plug into. The component needs to plug
- into it to know when it failed, etc.
+ - `b10_init` the b10_init object to plug into. The component needs
+ to plug into it to know when it failed, etc.
- `kind` is the kind of component. It may be one of:
* 'core' means the system can't run without it and it can't be
safely restarted. If it does not start, the system is brought
@@ -127,7 +127,7 @@ class BaseComponent:
Note that the __init__ method of child class should have these
parameters:
- __init__(self, process, boss, kind, address=None, params=None)
+ __init__(self, process, b10_init, kind, address=None, params=None)
The extra parameters are:
- `process` - which program should be started.
@@ -153,7 +153,7 @@ class BaseComponent:
raise ValueError('Component kind can not be ' + kind)
self.__state = STATE_STOPPED
self._kind = kind
- self._boss = boss
+ self._b10_init = b10_init
self._original_start_time = None
def start(self):
@@ -204,13 +204,14 @@ class BaseComponent:
def failed(self, exit_code):
"""
- Notify the component it crashed. This will be called from boss object.
+ Notify the component it crashed. This will be called from b10_init
+ object.
If you try to call failed on a component that is not running,
a ValueError is raised.
If it is a core component or needed component and it was started only
- recently, the component will become dead and will ask the boss to shut
+ recently, the component will become dead and will ask b10_init to shut
down with error exit status. A dead component can't be started again.
Otherwise the component will try to restart.
@@ -253,7 +254,7 @@ class BaseComponent:
self._original_start_time):
self.__state = STATE_DEAD
logger.fatal(BIND10_COMPONENT_UNSATISFIED, self.name())
- self._boss.component_shutdown(1)
+ self._b10_init.component_shutdown(1)
return False
# This means we want to restart
else:
@@ -326,7 +327,7 @@ class BaseComponent:
should be registered).
You should register all the processes created by calling
- self._boss.register_process.
+ self._b10_init.register_process.
"""
pass
@@ -407,15 +408,15 @@ class Component(BaseComponent):
directly. It is not recommended to override methods of this class
on one-by-one basis.
"""
- def __init__(self, process, boss, kind, address=None, params=None,
+ def __init__(self, process, b10_init, kind, address=None, params=None,
start_func=None):
"""
Creates the component in not running mode.
The parameters are:
- `process` is the name of the process to start.
- - `boss` the boss object to plug into. The component needs to plug
- into it to know when it failed, etc.
+ - `b10_init` the b10-init object to plug into. The component needs to
+ plug into it to know when it failed, etc.
- `kind` is the kind of component. Refer to the documentation of
BaseComponent for details.
- `address` is the address on message bus. It is used to ask it to
@@ -429,7 +430,7 @@ class Component(BaseComponent):
There's a sensible default if not provided, which just launches
the program without any special care.
"""
- BaseComponent.__init__(self, boss, kind)
+ BaseComponent.__init__(self, b10_init, kind)
self._process = process
self._start_func = start_func
self._address = address
@@ -443,25 +444,26 @@ class Component(BaseComponent):
process and return the procinfo object describing the running process.
If you don't provide the _start_func, the usual startup by calling
- boss.start_simple is performed.
+ b10_init.start_simple is performed.
"""
# This one is not tested. For one, it starts a real process
# which is out of scope of unit tests, for another, it just
- # delegates the starting to other function in boss (if a derived
+ # delegates the starting to other function in b10_init (if a derived
# class does not provide an override function), which is tested
# by use.
if self._start_func is not None:
procinfo = self._start_func()
else:
# TODO Handle params, etc
- procinfo = self._boss.start_simple(self._process)
+ procinfo = self._b10_init.start_simple(self._process)
self._procinfo = procinfo
- self._boss.register_process(self.pid(), self)
+ self._b10_init.register_process(self.pid(), self)
def _stop_internal(self):
- self._boss.stop_process(self._process, self._address, self.pid())
+ self._b10_init.stop_process(self._process, self._address, self.pid())
# TODO Some way to wait for the process that doesn't want to
- # terminate and kill it would prove nice (or add it to boss somewhere?)
+ # terminate and kill it would prove nice (or add it to b10_init
+ # somewhere?)
def name(self):
"""
@@ -498,7 +500,7 @@ class Configurator:
b10-auth as core, it is safe to stop that one.
The parameters are:
- * `boss`: The boss we are managing for.
+ * `b10_init`: The b10-init we are managing for.
* `specials`: Dict of specially started components. Each item is a class
representing the component.
@@ -527,13 +529,14 @@ class Configurator:
priority are started before the ones with lower priority. If it is
not present, it defaults to 0.
"""
- def __init__(self, boss, specials = {}):
+ def __init__(self, b10_init, specials = {}):
"""
Initializes the configurator, but nothing is started yet.
- The boss parameter is the boss object used to start and stop processes.
+ The b10_init parameter is the b10-init object used to start and stop
+ processes.
"""
- self.__boss = boss
+ self.__b10_init = b10_init
# These could be __private, but as we access them from within unittest,
# it's more comfortable to have them just _protected.
@@ -551,7 +554,7 @@ class Configurator:
def startup(self, configuration):
"""
Starts the first set of processes. This configuration is expected
- to be hardcoded from the boss itself to start the configuration
+ to be hardcoded from the b10-init itself to start the configuration
manager and other similar things.
"""
if self._running:
@@ -642,7 +645,7 @@ class Configurator:
# TODO: Better error handling
creator = self.__specials[component_config['special']]
component = creator(component_config.get('process', cname),
- self.__boss, component_config['kind'],
+ self.__b10_init, component_config['kind'],
component_config.get('address'),
component_config.get('params'))
priority = component_config.get('priority', 0)
diff --git a/src/lib/python/isc/bind10/sockcreator.py b/src/lib/python/isc/bind10/sockcreator.py
index 593d1a6..db9e6c5 100644
--- a/src/lib/python/isc/bind10/sockcreator.py
+++ b/src/lib/python/isc/bind10/sockcreator.py
@@ -20,10 +20,10 @@ import errno
import copy
import subprocess
import copy
-from isc.log_messages.bind10_messages import *
+from isc.log_messages.init_messages import *
from libutil_io_python import recv_fd
-logger = isc.log.Logger("boss")
+logger = isc.log.Logger("init")
"""
Module that comunicates with the privileged socket creator (b10-sockcreator).
@@ -251,7 +251,7 @@ class Creator(Parser):
"""Function used before running a program that needs to run as a
different user."""
# Put us into a separate process group so we don't get
- # SIGINT signals on Ctrl-C (the boss will shut everthing down by
+ # SIGINT signals on Ctrl-C (b10-init will shut everthing down by
# other means).
os.setpgrp()
diff --git a/src/lib/python/isc/bind10/socket_cache.py b/src/lib/python/isc/bind10/socket_cache.py
index d6c1175..1c5199c 100644
--- a/src/lib/python/isc/bind10/socket_cache.py
+++ b/src/lib/python/isc/bind10/socket_cache.py
@@ -106,7 +106,8 @@ class Cache:
This is the cache for sockets from socket creator. The purpose of cache
is to hold the sockets that were requested, until they are no longer
needed. One reason is, the socket is created before it is sent over the
- unix domain socket in boss, so we need to keep it somewhere for a while.
+ unix domain socket in b10-init, so we need to keep it somewhere for a
+ while.
The other reason is, a single socket might be requested multiple times.
So we keep it here in case someone else might ask for it.
@@ -114,7 +115,7 @@ class Cache:
Each socket kept here has a reference count and when it drops to zero,
it is removed from cache and closed.
- This is expected to be part of Boss, it is not a general utility class.
+ This is expected to be part of Init, it is not a general utility class.
It is not expected to be subclassed. The methods and members are named
as protected so tests are easier access into them.
@@ -175,7 +176,7 @@ class Cache:
restrictions and of all copies of socket handed out are considered,
so it can be raised even if you call it with share_mode 'ANY').
- isc.bind10.sockcreator.CreatorError: fatal creator errors are
- propagated. Thay should cause the boss to exit if ever encountered.
+ propagated. Thay should cause b10-init to exit if ever encountered.
Note that it isn't guaranteed the tokens would be unique and they
should be used as an opaque handle only.
@@ -220,11 +221,11 @@ class Cache:
one returned from previous call from get_token. The token can be used
only once to receive the socket.
- The application is a token representing the application that requested
- it. Currently, boss uses the file descriptor of connection from the
- application, but anything which can be a key in a dict is OK from the
- cache's point of view. You just need to use the same thing in
- drop_application.
+ The application is a token representing the application that
+ requested it. Currently, b10-init uses the file descriptor of
+ connection from the application, but anything which can be a key in
+ a dict is OK from the cache's point of view. You just need to use
+ the same thing in drop_application.
In case the token is considered invalid (it doesn't come from the
get_token, it was already used, the socket wasn't picked up soon
diff --git a/src/lib/python/isc/bind10/special_component.py b/src/lib/python/isc/bind10/special_component.py
index dcd9b64..3196795 100644
--- a/src/lib/python/isc/bind10/special_component.py
+++ b/src/lib/python/isc/bind10/special_component.py
@@ -26,23 +26,23 @@ class SockCreator(BaseComponent):
Note: _creator shouldn't be reset explicitly once created. The
underlying Popen object would then wait() the child process internally,
- which breaks the assumption of the boss, who is expecting to see
+ which breaks the assumption of b10-init, who is expecting to see
the process die in waitpid().
"""
- def __init__(self, process, boss, kind, address=None, params=None):
- BaseComponent.__init__(self, boss, kind)
+ def __init__(self, process, b10_init, kind, address=None, params=None):
+ BaseComponent.__init__(self, b10_init, kind)
self.__creator = None
def _start_internal(self):
- self._boss.curproc = 'b10-sockcreator'
+ self._b10_init.curproc = 'b10-sockcreator'
self.__creator = isc.bind10.sockcreator.Creator(LIBEXECPATH + ':' +
os.environ['PATH'])
- self._boss.register_process(self.pid(), self)
- self._boss.set_creator(self.__creator)
- self._boss.log_started(self.pid())
+ self._b10_init.register_process(self.pid(), self)
+ self._b10_init.set_creator(self.__creator)
+ self._b10_init.log_started(self.pid())
# We are now ready for switching user.
- self._boss.change_user()
+ self._b10_init.change_user()
def _stop_internal(self):
self.__creator.terminate()
@@ -64,12 +64,12 @@ class SockCreator(BaseComponent):
class Msgq(Component):
"""
- The message queue. Starting is passed to boss, stopping is not supported
- and we leave the boss kill it by signal.
+ The message queue. Starting is passed to b10-init, stopping is not
+ supported and we leave b10-init kill it by signal.
"""
- def __init__(self, process, boss, kind, address=None, params=None):
- Component.__init__(self, process, boss, kind, None, None,
- boss.start_msgq)
+ def __init__(self, process, b10_init, kind, address=None, params=None):
+ Component.__init__(self, process, b10_init, kind, None, None,
+ b10_init.start_msgq)
def _stop_internal(self):
"""
@@ -78,7 +78,7 @@ class Msgq(Component):
But as it is stateless, it's OK to kill it.
So we disable this method (as the only time it could be called is
- during shutdown) and wait for the boss to kill it in the next shutdown
+ during shutdown) and wait for b10-init to kill it in the next shutdown
step.
This actually breaks the recommendation at Component we shouldn't
@@ -89,24 +89,24 @@ class Msgq(Component):
pass
class CfgMgr(Component):
- def __init__(self, process, boss, kind, address=None, params=None):
- Component.__init__(self, process, boss, kind, 'ConfigManager',
- None, boss.start_cfgmgr)
+ def __init__(self, process, b10_init, kind, address=None, params=None):
+ Component.__init__(self, process, b10_init, kind, 'ConfigManager',
+ None, b10_init.start_cfgmgr)
class Auth(Component):
- def __init__(self, process, boss, kind, address=None, params=None):
- Component.__init__(self, process, boss, kind, 'Auth', None,
- boss.start_auth)
+ def __init__(self, process, b10_init, kind, address=None, params=None):
+ Component.__init__(self, process, b10_init, kind, 'Auth', None,
+ b10_init.start_auth)
class Resolver(Component):
- def __init__(self, process, boss, kind, address=None, params=None):
- Component.__init__(self, process, boss, kind, 'Resolver', None,
- boss.start_resolver)
+ def __init__(self, process, b10_init, kind, address=None, params=None):
+ Component.__init__(self, process, b10_init, kind, 'Resolver', None,
+ b10_init.start_resolver)
class CmdCtl(Component):
- def __init__(self, process, boss, kind, address=None, params=None):
- Component.__init__(self, process, boss, kind, 'Cmdctl', None,
- boss.start_cmdctl)
+ def __init__(self, process, b10_init, kind, address=None, params=None):
+ Component.__init__(self, process, b10_init, kind, 'Cmdctl', None,
+ b10_init.start_cmdctl)
def get_specials():
"""
List of specially started components. Each one should be the class than can
diff --git a/src/lib/python/isc/bind10/tests/component_test.py b/src/lib/python/isc/bind10/tests/component_test.py
index 8603201..adc035e 100644
--- a/src/lib/python/isc/bind10/tests/component_test.py
+++ b/src/lib/python/isc/bind10/tests/component_test.py
@@ -31,9 +31,9 @@ class TestError(Exception):
"""
pass
-class BossUtils:
+class InitUtils:
"""
- A class that brings some utilities for pretending we're Boss.
+ A class that brings some utilities for pretending we're Init.
This is expected to be inherited by the testcases themselves.
"""
def setUp(self):
@@ -70,7 +70,7 @@ class BossUtils:
isc.bind10.component.time.time = lambda: tm + 30
# Few functions that pretend to start something. Part of pretending of
- # being boss.
+ # being b10-init.
def start_msgq(self):
pass
@@ -86,7 +86,7 @@ class BossUtils:
def start_cmdctl(self):
pass
-class ComponentTests(BossUtils, unittest.TestCase):
+class ComponentTests(InitUtils, unittest.TestCase):
"""
Tests for the bind10.component.Component class
"""
@@ -94,7 +94,7 @@ class ComponentTests(BossUtils, unittest.TestCase):
"""
Pretend a newly started system.
"""
- BossUtils.setUp(self)
+ InitUtils.setUp(self)
self._shutdown = False
self._exitcode = None
self.__start_called = False
@@ -103,7 +103,7 @@ class ComponentTests(BossUtils, unittest.TestCase):
self.__registered_processes = {}
self.__stop_process_params = None
self.__start_simple_params = None
- # Pretending to be boss
+ # Pretending to be b10-init
self.__change_user_called = False
def change_user(self):
@@ -149,7 +149,7 @@ class ComponentTests(BossUtils, unittest.TestCase):
its behaviour.
The process used is some nonsense, as this isn't used in this
- kind of tests and we pretend to be the boss.
+ kind of tests and we pretend to be the b10-init.
"""
component = Component('No process', self, kind, 'homeless', [])
component._start_internal = self.__start
@@ -176,7 +176,7 @@ class ComponentTests(BossUtils, unittest.TestCase):
Test the correct data are stored inside the component.
"""
component = self.__create_component('core')
- self.assertEqual(self, component._boss)
+ self.assertEqual(self, component._b10_init)
self.assertEqual("No process", component._process)
self.assertEqual(None, component._start_func)
self.assertEqual("homeless", component._address)
@@ -539,7 +539,7 @@ class ComponentTests(BossUtils, unittest.TestCase):
def register_process(self, pid, process):
"""
- Part of pretending to be a boss
+ Part of pretending to be a b10-init
"""
self.__registered_processes[pid] = process
@@ -570,13 +570,13 @@ class ComponentTests(BossUtils, unittest.TestCase):
def stop_process(self, process, address, pid):
"""
- Part of pretending to be boss.
+ Part of pretending to be b10-init.
"""
self.__stop_process_params = (process, address, pid)
def start_simple(self, process):
"""
- Part of pretending to be boss.
+ Part of pretending to be b10-init.
"""
self.__start_simple_params = process
@@ -632,14 +632,14 @@ class ComponentTests(BossUtils, unittest.TestCase):
def set_creator(self, creator):
"""
- Part of faking being the boss. Check the creator (faked as well)
+ Part of faking being the b10-init. Check the creator (faked as well)
is passed here.
"""
self.assertTrue(isinstance(creator, self.FakeCreator))
def log_started(self, pid):
"""
- Part of faking the boss. Check the pid is the one of the fake creator.
+ Part of faking the b10-init. Check the pid is the one of the fake creator.
"""
self.assertEqual(42, pid)
@@ -706,13 +706,13 @@ class FailComponent(BaseComponent):
"""
A mock component that fails whenever it is started.
"""
- def __init__(self, name, boss, kind, address=None, params=None):
- BaseComponent.__init__(self, boss, kind)
+ def __init__(self, name, b10_init, kind, address=None, params=None):
+ BaseComponent.__init__(self, b10_init, kind)
def _start_internal(self):
raise TestError("test error")
-class ConfiguratorTest(BossUtils, unittest.TestCase):
+class ConfiguratorTest(InitUtils, unittest.TestCase):
"""
Tests for the configurator.
"""
@@ -720,7 +720,7 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
"""
Prepare some test data for the tests.
"""
- BossUtils.setUp(self)
+ InitUtils.setUp(self)
self.log = []
# The core "hardcoded" configuration
self.__core = {
@@ -755,11 +755,12 @@ class ConfiguratorTest(BossUtils, unittest.TestCase):
self.__core_log = self.__core_log_create + self.__core_log_start
self.__specials = { 'test': self.__component_test }
- def __component_test(self, process, boss, kind, address=None, params=None):
+ def __component_test(self, process, b10_init, kind, address=None,
+ params=None):
"""
Create a test component. It will log events to us.
"""
- self.assertEqual(self, boss)
+ self.assertEqual(self, b10_init)
return TestComponent(self, process, kind, address, params)
def test_init(self):
diff --git a/src/lib/python/isc/config/cfgmgr.py b/src/lib/python/isc/config/cfgmgr.py
index 9563cab..421c371 100644
--- a/src/lib/python/isc/config/cfgmgr.py
+++ b/src/lib/python/isc/config/cfgmgr.py
@@ -68,6 +68,62 @@ class ConfigManagerData:
self.db_filename = data_path + os.sep + file_name
self.data_path = data_path
+ def check_for_updates(file_config):
+ """
+ Given the parsed JSON data from the config file,
+ check whether it needs updating due to version changes.
+ Return the data with updates (or the original data if no
+ updates were necessary).
+ Even though it is at this moment not technically necessary, this
+ function makes and returns a copy of the given data.
+ """
+ config = copy.deepcopy(file_config)
+ if 'version' in config:
+ data_version = config['version']
+ else:
+ # If it is not present, assume latest or earliest?
+ data_version = 1
+
+ # For efficiency, if up-to-date, return now
+ if data_version == config_data.BIND10_CONFIG_DATA_VERSION:
+ return config
+
+ # Don't know what to do if it is more recent
+ if data_version > config_data.BIND10_CONFIG_DATA_VERSION:
+ raise ConfigManagerDataReadError(
+ "Cannot load configuration file: version "
+ "%d not yet supported" % config['version'])
+
+ # At some point we might give up supporting older versions
+ if data_version < 1:
+ raise ConfigManagerDataReadError(
+ "Cannot load configuration file: version "
+ "%d no longer supported" % config['version'])
+
+ # Ok, so we have a still-supported older version. Apply all
+ # updates
+ new_data_version = data_version
+ if new_data_version == 1:
+ # only format change, no other changes necessary
+ new_data_version = 2
+ if new_data_version == 2:
+ # 'Boss' got changed to 'Init'; If for some reason both are
+ # present, simply ignore the old one
+ if 'Boss' in config:
+ if not 'Init' in config:
+ config['Init'] = config['Boss']
+ del config['Boss']
+ else:
+ # This should not happen, but we don't want to overwrite
+ # any config in this case, so warn about it
+ logger.warn(CFGMGR_CONFIG_UPDATE_BOSS_AND_INIT_FOUND)
+ new_data_version = 3
+
+ config['version'] = new_data_version
+ logger.info(CFGMGR_AUTOMATIC_CONFIG_DATABASE_UPDATE, data_version,
+ new_data_version)
+ return config
+
def read_from_file(data_path, file_name):
"""Read the current configuration found in the file file_name.
If file_name is absolute, data_path is ignored. Otherwise
@@ -90,21 +146,7 @@ class ConfigManagerData:
# If possible, we automatically convert to the new
# scheme and update the configuration
# If not, we raise an exception
- if 'version' in file_config:
- if file_config['version'] == config_data.BIND10_CONFIG_DATA_VERSION:
- config.data = file_config
- elif file_config['version'] == 1:
- # only format change, no other changes necessary
- file_config['version'] = 2
- logger.info(CFGMGR_AUTOMATIC_CONFIG_DATABASE_UPDATE, 1, 2)
- config.data = file_config
- else:
- if config_data.BIND10_CONFIG_DATA_VERSION > file_config['version']:
- raise ConfigManagerDataReadError("Cannot load configuration file: version %d no longer supported" % file_config['version'])
- else:
- raise ConfigManagerDataReadError("Cannot load configuration file: version %d not yet supported" % file_config['version'])
- else:
- raise ConfigManagerDataReadError("No version information in configuration file " + config.db_filename)
+ config.data = ConfigManagerData.check_for_updates(file_config)
except IOError as ioe:
# if IOError is 'no such file or directory', then continue
# (raise empty), otherwise fail (raise error)
@@ -210,7 +252,7 @@ class ConfigManager:
else:
self.cc = isc.cc.Session()
self.cc.group_subscribe("ConfigManager")
- self.cc.group_subscribe("Boss", "ConfigManager")
+ self.cc.group_subscribe("Init", "ConfigManager")
self.running = False
# As a core module, CfgMgr is different than other modules,
# as it does not use a ModuleCCSession, and hence needs
@@ -232,10 +274,10 @@ class ConfigManager:
# handler, so make it use defaults (and flush any buffered logs)
ccsession.default_logconfig_handler({}, self.log_config_data)
- def notify_boss(self):
- """Notifies the Boss module that the Config Manager is running"""
+ def notify_b10_init(self):
+ """Notifies the Init module that the Config Manager is running"""
# TODO: Use a real, broadcast notification here.
- self.cc.group_sendmsg({"running": "ConfigManager"}, "Boss")
+ self.cc.group_sendmsg({"running": "ConfigManager"}, "Init")
def set_module_spec(self, spec):
"""Adds a ModuleSpec"""
diff --git a/src/lib/python/isc/config/cfgmgr_messages.mes b/src/lib/python/isc/config/cfgmgr_messages.mes
index 8701db3..4b12bfd 100644
--- a/src/lib/python/isc/config/cfgmgr_messages.mes
+++ b/src/lib/python/isc/config/cfgmgr_messages.mes
@@ -41,6 +41,16 @@ system. The most likely cause is that msgq is not running.
The configuration manager is starting, reading and saving the configuration
settings to the shown file.
+% CFGMGR_CONFIG_UPDATE_BOSS_AND_INIT_FOUND Configuration found for both 'Boss' and 'Init', ignoring 'Boss'
+In the process of updating the configuration from version 2 to version 3,
+the configuration manager has found that there are existing configurations
+for both the old value 'Boss' and the new value 'Init'. This should in
+theory not happen, as in older versions 'Init' does not exist, and in newer
+versions 'Boss' does not exist. The configuration manager will continue
+with the update process, leaving the values for both as they are, so as not
+to overwrite any settings. However, the values for 'Boss' are ignored by
+BIND 10, and it is probably wise to check the configuration file manually.
+
% CFGMGR_DATA_READ_ERROR error reading configuration database from disk: %1
There was a problem reading the persistent configuration data as stored
on disk. The file may be corrupted, or it is of a version from where
diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py
index ae61e2a..495d20b 100644
--- a/src/lib/python/isc/config/config_data.py
+++ b/src/lib/python/isc/config/config_data.py
@@ -27,7 +27,7 @@ import copy
class ConfigDataError(Exception): pass
-BIND10_CONFIG_DATA_VERSION = 2
+BIND10_CONFIG_DATA_VERSION = 3
# Helper functions
def spec_part_is_list(spec_part):
diff --git a/src/lib/python/isc/config/tests/cfgmgr_test.py b/src/lib/python/isc/config/tests/cfgmgr_test.py
index 5322901..d99fb86 100644
--- a/src/lib/python/isc/config/tests/cfgmgr_test.py
+++ b/src/lib/python/isc/config/tests/cfgmgr_test.py
@@ -49,6 +49,49 @@ class TestConfigManagerData(unittest.TestCase):
self.assertEqual(self.config_manager_data.db_filename,
self.writable_data_path + os.sep + "b10-config.db")
+ def test_check_for_updates_up_to_date(self):
+ # This should automatically give an up-to-date version
+ file_config = ConfigManagerData.read_from_file(
+ self.writable_data_path, "b10-config.db").data
+ updated_config = ConfigManagerData.check_for_updates(file_config)
+ self.assertEqual(file_config, updated_config)
+
+ def test_check_for_updates_from_1(self):
+ config = { "version": 1,
+ "foo": "bar",
+ "something": [ 1, 2, 3 ] }
+ updated = ConfigManagerData.check_for_updates(config)
+ config['version'] = config_data.BIND10_CONFIG_DATA_VERSION
+ self.assertEqual(config, updated)
+
+ def test_check_for_updates_from_2(self):
+ # No 'Boss' present, no change (except version)
+ config = { "version": 2,
+ "foo": "bar",
+ "something": [ 1, 2, 3 ] }
+ updated = ConfigManagerData.check_for_updates(config)
+ config['version'] = config_data.BIND10_CONFIG_DATA_VERSION
+ self.assertEqual(config, updated)
+
+ # With Boss, should be changed to 'Init'
+ config = { "version": 2,
+ "Boss": { "some config": 1 },
+ "something": [ 1, 2, 3 ] }
+ updated = ConfigManagerData.check_for_updates(config)
+ config = { "version": config_data.BIND10_CONFIG_DATA_VERSION,
+ "Init": { "some config": 1 },
+ "something": [ 1, 2, 3 ] }
+ self.assertEqual(config, updated)
+
+ # With Boss AND Init, no change
+ config = { "version": 2,
+ "Boss": { "some config": 1 },
+ "Init": { "some other config": 1 },
+ "something": [ 1, 2, 3 ] }
+ updated = ConfigManagerData.check_for_updates(config)
+ config['version'] = config_data.BIND10_CONFIG_DATA_VERSION
+ self.assertEqual(config, updated)
+
def test_read_from_file(self):
ConfigManagerData.read_from_file(self.writable_data_path, "b10-config.db")
self.assertRaises(ConfigManagerDataEmpty,
@@ -174,12 +217,12 @@ class TestConfigManager(unittest.TestCase):
self.assertEqual(self.cm.data_path, self.writable_data_path)
self.assertIsNotNone(self.cm.config)
self.assertTrue(self.fake_session.has_subscription("ConfigManager"))
- self.assertTrue(self.fake_session.has_subscription("Boss", "ConfigManager"))
+ self.assertTrue(self.fake_session.has_subscription("Init", "ConfigManager"))
self.assertFalse(self.cm.running)
- def test_notify_boss(self):
- self.cm.notify_boss()
- msg = self.fake_session.get_message("Boss", None)
+ def test_notify_b10_init(self):
+ self.cm.notify_b10_init()
+ msg = self.fake_session.get_message("Init", None)
self.assertTrue(msg)
# this one is actually wrong, but 'current status quo'
self.assertEqual(msg, {"running": "ConfigManager"})
@@ -539,7 +582,8 @@ class TestConfigManager(unittest.TestCase):
def test_set_config_all(self):
my_ok_answer = { 'result': [ 0 ] }
- self.assertEqual({"version": 2}, self.cm.config.data)
+ self.assertEqual({"version": config_data.BIND10_CONFIG_DATA_VERSION},
+ self.cm.config.data)
self.fake_session.group_sendmsg(my_ok_answer, "ConfigManager")
self.cm.handle_msg(ccsession.create_command(
diff --git a/src/lib/python/isc/log_messages/Makefile.am b/src/lib/python/isc/log_messages/Makefile.am
index 97ff6e6..e0f62d5 100644
--- a/src/lib/python/isc/log_messages/Makefile.am
+++ b/src/lib/python/isc/log_messages/Makefile.am
@@ -1,7 +1,7 @@
SUBDIRS = work
EXTRA_DIST = __init__.py
-EXTRA_DIST += bind10_messages.py
+EXTRA_DIST += init_messages.py
EXTRA_DIST += cmdctl_messages.py
EXTRA_DIST += ddns_messages.py
EXTRA_DIST += stats_messages.py
@@ -20,7 +20,7 @@ EXTRA_DIST += dbutil_messages.py
EXTRA_DIST += msgq_messages.py
CLEANFILES = __init__.pyc
-CLEANFILES += bind10_messages.pyc
+CLEANFILES += init_messages.pyc
CLEANFILES += cmdctl_messages.pyc
CLEANFILES += ddns_messages.pyc
CLEANFILES += stats_messages.pyc
diff --git a/src/lib/python/isc/log_messages/bind10_messages.py b/src/lib/python/isc/log_messages/bind10_messages.py
deleted file mode 100644
index 68ce94c..0000000
--- a/src/lib/python/isc/log_messages/bind10_messages.py
+++ /dev/null
@@ -1 +0,0 @@
-from work.bind10_messages import *
diff --git a/src/lib/python/isc/log_messages/init_messages.py b/src/lib/python/isc/log_messages/init_messages.py
new file mode 100644
index 0000000..15288bf
--- /dev/null
+++ b/src/lib/python/isc/log_messages/init_messages.py
@@ -0,0 +1 @@
+from work.init_messages import *
diff --git a/src/lib/server_common/portconfig.cc b/src/lib/server_common/portconfig.cc
index 530c919..b214ef5 100644
--- a/src/lib/server_common/portconfig.cc
+++ b/src/lib/server_common/portconfig.cc
@@ -152,7 +152,7 @@ installListenAddresses(const AddressList& new_addresses,
throw;
} catch (const exception& e) {
// Any other kind of exception is fatal. It might mean we are in
- // inconsistent state with the boss/socket creator, so we abort
+ // inconsistent state with the b10-init/socket creator, so we abort
// to make sure it doesn't last.
LOG_FATAL(logger, SRVCOMM_EXCEPTION_ALLOC).arg(e.what());
abort();
diff --git a/src/lib/server_common/portconfig.h b/src/lib/server_common/portconfig.h
index 0795728..7213e09 100644
--- a/src/lib/server_common/portconfig.h
+++ b/src/lib/server_common/portconfig.h
@@ -92,8 +92,9 @@ parseAddresses(isc::data::ConstElementPtr addresses,
/// but removes all the sockets it listened on. One of the exceptions is
/// propagated.
///
-/// The ports are requested from the socket creator through boss. Therefore
-/// you need to initialize the SocketRequestor before using this function.
+/// The ports are requested from the socket creator through b10-init.
+/// Therefore you need to initialize the SocketRequestor before using this
+/// function.
///
/// \param new_addresses are the addresses you want to listen on.
/// \param address_store is the place you store your current addresses. It is
@@ -107,7 +108,7 @@ parseAddresses(isc::data::ConstElementPtr addresses,
///
/// \throw asiolink::IOError when initialization or closing of socket fails.
/// \throw isc::server_common::SocketRequestor::Socket error when the
-/// boss/socket creator doesn't want to give us the socket.
+/// b10-init/socket creator doesn't want to give us the socket.
/// \throw std::bad_alloc when allocation fails.
/// \throw isc::InvalidOperation when the function is called and the
/// SocketRequestor isn't initialized yet.
diff --git a/src/lib/server_common/socket_request.cc b/src/lib/server_common/socket_request.cc
index e471ad0..981930d 100644
--- a/src/lib/server_common/socket_request.cc
+++ b/src/lib/server_common/socket_request.cc
@@ -34,21 +34,21 @@ namespace server_common {
namespace {
SocketRequestor* requestor(NULL);
-// Before the boss process calls send_fd, it first sends this
+// Before the b10-init process calls send_fd, it first sends this
// string to indicate success, followed by the file descriptor
const std::string& CREATOR_SOCKET_OK() {
static const std::string str("1\n");
return (str);
}
-// Before the boss process calls send_fd, it sends this
+// Before the b10-init process calls send_fd, it sends this
// string to indicate failure. It will not send a file descriptor.
const std::string& CREATOR_SOCKET_UNAVAILABLE() {
static const std::string str("0\n");
return (str);
}
-// The name of the ccsession command to request a socket from boss
+// The name of the ccsession command to request a socket from b10-init
// (the actual format of command and response are hardcoded in their
// respective methods)
const std::string& REQUEST_SOCKET_COMMAND() {
@@ -56,7 +56,7 @@ const std::string& REQUEST_SOCKET_COMMAND() {
return (str);
}
-// The name of the ccsession command to tell boss we no longer need
+// The name of the ccsession command to tell b10-init we no longer need
// a socket (the actual format of command and response are hardcoded
// in their respective methods)
const std::string& RELEASE_SOCKET_COMMAND() {
@@ -69,7 +69,7 @@ const size_t SOCKET_ERROR_CODE = 2;
const size_t SHARE_ERROR_CODE = 3;
// A helper converter from numeric protocol ID to the corresponding string.
-// used both for generating a message for the boss process and for logging.
+// used both for generating a message for the b10-init process and for logging.
inline const char*
protocolString(SocketRequestor::Protocol protocol) {
switch (protocol) {
@@ -84,7 +84,7 @@ protocolString(SocketRequestor::Protocol protocol) {
// Creates the cc session message to request a socket.
// The actual command format is hardcoded, and should match
-// the format as read in bind10_src.py.in
+// the format as read in b10-init.py.in
isc::data::ConstElementPtr
createRequestSocketMessage(SocketRequestor::Protocol protocol,
const std::string& address, uint16_t port,
@@ -125,7 +125,7 @@ createReleaseSocketMessage(const std::string& token) {
return (isc::config::createCommand(RELEASE_SOCKET_COMMAND(), release));
}
-// Checks and parses the response receive from Boss
+// Checks and parses the response receive from Init
// If successful, token and path will be set to the values found in the
// answer.
// If the response was an error response, or does not contain the
@@ -158,7 +158,7 @@ readRequestSocketAnswer(isc::data::ConstElementPtr recv_msg,
path = answer->get("path")->stringValue();
}
-// Connect to the domain socket that has been received from Boss.
+// Connect to the domain socket that has been received from Init.
// (i.e. the one that is used to pass created sockets over).
//
// This should only be called if the socket had not been connected to
@@ -211,14 +211,14 @@ createFdShareSocket(const std::string& path) {
// \return the socket fd that has been read
int
getSocketFd(const std::string& token, int sock_pass_fd) {
- // Tell the boss the socket token.
+ // Tell b10-init the socket token.
const std::string token_data = token + "\n";
if (!isc::util::io::write_data(sock_pass_fd, token_data.c_str(),
token_data.size())) {
isc_throw(SocketRequestor::SocketError, "Error writing socket token");
}
- // Boss first sends some data to signal that getting the socket
+ // Init first sends some data to signal that getting the socket
// from its cache succeeded
char status[3]; // We need a space for trailing \0, hence 3
memset(status, 0, 3);
@@ -226,7 +226,7 @@ getSocketFd(const std::string& token, int sock_pass_fd) {
isc_throw(SocketRequestor::SocketError,
"Error reading status code while requesting socket");
}
- // Actual status value hardcoded by boss atm.
+ // Actual status value hardcoded by b10-init atm.
if (CREATOR_SOCKET_UNAVAILABLE() == status) {
isc_throw(SocketRequestor::SocketError,
"CREATOR_SOCKET_UNAVAILABLE returned");
@@ -258,7 +258,7 @@ getSocketFd(const std::string& token, int sock_pass_fd) {
}
// This implementation class for SocketRequestor uses
-// a CC session for communication with the boss process,
+// a CC session for communication with the b10-init process,
// and fd_share to read out the socket(s).
// Since we only use a reference to the session, it must never
// be closed during the lifetime of this class
@@ -300,10 +300,10 @@ public:
share_name.empty() ? app_name_ :
share_name);
- // Send it to boss
- const int seq = session_.group_sendmsg(request_msg, "Boss");
+ // Send it to b10-init
+ const int seq = session_.group_sendmsg(request_msg, "Init");
- // Get the answer from the boss.
+ // Get the answer from b10-init.
// Just do a blocking read, we can't really do much anyway
isc::data::ConstElementPtr env, recv_msg;
if (!session_.group_recvmsg(env, recv_msg, false, seq)) {
@@ -330,12 +330,12 @@ public:
const isc::data::ConstElementPtr release_msg =
createReleaseSocketMessage(token);
- // Send it to boss
- const int seq = session_.group_sendmsg(release_msg, "Boss");
+ // Send it to b10-init
+ const int seq = session_.group_sendmsg(release_msg, "Init");
LOG_DEBUG(logger, DBGLVL_TRACE_DETAIL, SOCKETREQUESTOR_RELEASESOCKET).
arg(token);
- // Get the answer from the boss.
+ // Get the answer from b10-init.
// Just do a blocking read, we can't really do much anyway
isc::data::ConstElementPtr env, recv_msg;
if (!session_.group_recvmsg(env, recv_msg, false, seq)) {
diff --git a/src/lib/server_common/tests/portconfig_unittest.cc b/src/lib/server_common/tests/portconfig_unittest.cc
index 0c971ee..48d69ba 100644
--- a/src/lib/server_common/tests/portconfig_unittest.cc
+++ b/src/lib/server_common/tests/portconfig_unittest.cc
@@ -330,8 +330,8 @@ TEST_F(InstallListenAddressesDeathTest, inconsistent) {
}
}
-// If we are unable to tell the boss we closed a socket, we abort, as we are
-// not consistent with the boss most probably.
+// If we are unable to tell the b10-init we closed a socket, we abort, as we
+// are not consistent with b10-init most probably.
TEST_F(InstallListenAddressesDeathTest, cantClose) {
if (!isc::util::unittests::runningOnValgrind()) {
installListenAddresses(valid_, store_, dnss_);
diff --git a/src/lib/server_common/tests/socket_requestor_test.cc b/src/lib/server_common/tests/socket_requestor_test.cc
index ac1731f..9085ba9 100644
--- a/src/lib/server_common/tests/socket_requestor_test.cc
+++ b/src/lib/server_common/tests/socket_requestor_test.cc
@@ -76,7 +76,7 @@ TEST(SocketRequestorAccess, initialized) {
initTestSocketRequestor(NULL);
}
-// This class contains a fake (module)ccsession to emulate answers from Boss
+// This class contains a fake (module)ccsession to emulate answers from Init
class SocketRequestorTest : public ::testing::Test {
public:
SocketRequestorTest() : session(ElementPtr(new ListElement),
@@ -100,7 +100,7 @@ public:
}
// Creates a valid socket request answer, as it would be sent by
- // Boss. 'valid' in terms of format, not values
+ // Init. 'valid' in terms of format, not values
void
addAnswer(const std::string& token, const std::string& path) {
ElementPtr answer_part = Element::createMap();
@@ -141,7 +141,7 @@ createExpectedRequest(const std::string& address,
// create the envelope
const ElementPtr packet = Element::createList();
- packet->add(Element::create("Boss"));
+ packet->add(Element::create("Init"));
packet->add(Element::create("*"));
packet->add(createCommand("get_socket", command_args));
packet->add(Element::create(-1));
@@ -282,7 +282,7 @@ createExpectedRelease(const std::string& token) {
// create the envelope
const ElementPtr packet = Element::createList();
- packet->add(Element::create("Boss"));
+ packet->add(Element::create("Init"));
packet->add(Element::create("*"));
packet->add(createCommand("drop_socket", command_args));
packet->add(Element::create(-1));
diff --git a/tests/lettuce/configurations/auth/auth_badzone.config.orig b/tests/lettuce/configurations/auth/auth_badzone.config.orig
index ab11bc9..f86882a 100644
--- a/tests/lettuce/configurations/auth/auth_badzone.config.orig
+++ b/tests/lettuce/configurations/auth/auth_badzone.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [{
"severity": "DEBUG",
@@ -29,7 +29,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
diff --git a/tests/lettuce/configurations/auth/auth_basic.config.orig b/tests/lettuce/configurations/auth/auth_basic.config.orig
index 4067fb1..24f615c 100644
--- a/tests/lettuce/configurations/auth/auth_basic.config.orig
+++ b/tests/lettuce/configurations/auth/auth_basic.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -13,7 +13,7 @@
"address": "127.0.0.1"
} ]
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
diff --git a/tests/lettuce/configurations/bindctl/bindctl.config.orig b/tests/lettuce/configurations/bindctl/bindctl.config.orig
index 3530b3e..ef0e8e2 100644
--- a/tests/lettuce/configurations/bindctl/bindctl.config.orig
+++ b/tests/lettuce/configurations/bindctl/bindctl.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -17,7 +17,7 @@
"data_sources": {
"classes": {}
},
- "Boss": {
+ "Init": {
"components": {
"b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
}
diff --git a/tests/lettuce/configurations/bindctl_commands.config.orig b/tests/lettuce/configurations/bindctl_commands.config.orig
index b60201d..980262b 100644
--- a/tests/lettuce/configurations/bindctl_commands.config.orig
+++ b/tests/lettuce/configurations/bindctl_commands.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -23,7 +23,7 @@
"address": "127.0.0.1"
} ]
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "dispensable", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
diff --git a/tests/lettuce/configurations/ddns/ddns.config.orig b/tests/lettuce/configurations/ddns/ddns.config.orig
index 93e7c1c..02978be 100644
--- a/tests/lettuce/configurations/ddns/ddns.config.orig
+++ b/tests/lettuce/configurations/ddns/ddns.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [
{
@@ -39,7 +39,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-xfrout": {
"kind": "dispensable",
diff --git a/tests/lettuce/configurations/ddns/noddns.config.orig b/tests/lettuce/configurations/ddns/noddns.config.orig
index 7a9a947..d075924 100644
--- a/tests/lettuce/configurations/ddns/noddns.config.orig
+++ b/tests/lettuce/configurations/ddns/noddns.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [
{
@@ -35,7 +35,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-xfrout": {"kind": "dispensable"},
"b10-auth": {"kind": "needed", "special": "auth"},
diff --git a/tests/lettuce/configurations/default.config b/tests/lettuce/configurations/default.config
index 9e1d3d1..2713def 100644
--- a/tests/lettuce/configurations/default.config
+++ b/tests/lettuce/configurations/default.config
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
diff --git a/tests/lettuce/configurations/example.org.config.orig b/tests/lettuce/configurations/example.org.config.orig
index c5545ed..7da6304 100644
--- a/tests/lettuce/configurations/example.org.config.orig
+++ b/tests/lettuce/configurations/example.org.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -26,7 +26,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
diff --git a/tests/lettuce/configurations/example.org.inmem.config b/tests/lettuce/configurations/example.org.inmem.config
index 7ea34b3..7ec921d 100644
--- a/tests/lettuce/configurations/example.org.inmem.config
+++ b/tests/lettuce/configurations/example.org.inmem.config
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [{
"severity": "DEBUG",
@@ -26,7 +26,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
diff --git a/tests/lettuce/configurations/example2.org.config b/tests/lettuce/configurations/example2.org.config
index eeb9733..3bb3330 100644
--- a/tests/lettuce/configurations/example2.org.config
+++ b/tests/lettuce/configurations/example2.org.config
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"severity": "DEBUG",
@@ -27,7 +27,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
diff --git a/tests/lettuce/configurations/inmemory_over_sqlite3/secondary.conf b/tests/lettuce/configurations/inmemory_over_sqlite3/secondary.conf
index 107c53f..d93a8c6 100644
--- a/tests/lettuce/configurations/inmemory_over_sqlite3/secondary.conf
+++ b/tests/lettuce/configurations/inmemory_over_sqlite3/secondary.conf
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -29,7 +29,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
diff --git a/tests/lettuce/configurations/ixfr-out/testset1-config.db b/tests/lettuce/configurations/ixfr-out/testset1-config.db
index e78c84a..d5eaf83 100644
--- a/tests/lettuce/configurations/ixfr-out/testset1-config.db
+++ b/tests/lettuce/configurations/ixfr-out/testset1-config.db
@@ -9,7 +9,7 @@
}
]
},
- "version": 2,
+ "version": 3,
"Logging": {
"loggers":
[
@@ -51,7 +51,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
diff --git a/tests/lettuce/configurations/multi_instance/multi_auth.config.orig b/tests/lettuce/configurations/multi_instance/multi_auth.config.orig
index fe482f9..96e25d8 100644
--- a/tests/lettuce/configurations/multi_instance/multi_auth.config.orig
+++ b/tests/lettuce/configurations/multi_instance/multi_auth.config.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -24,7 +24,7 @@
}]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth-2": {"kind": "dispensable", "special": "auth"},
"b10-auth": {"kind": "dispensable", "special": "auth"},
diff --git a/tests/lettuce/configurations/no_db_file.config b/tests/lettuce/configurations/no_db_file.config
index bc4ff5f..9e6c168 100644
--- a/tests/lettuce/configurations/no_db_file.config
+++ b/tests/lettuce/configurations/no_db_file.config
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"severity": "DEBUG",
@@ -27,7 +27,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-cmdctl": { "special": "cmdctl", "kind": "needed" }
diff --git a/tests/lettuce/configurations/nsec3/nsec3_auth.config b/tests/lettuce/configurations/nsec3/nsec3_auth.config
index 618c5ef..5dfffa1 100644
--- a/tests/lettuce/configurations/nsec3/nsec3_auth.config
+++ b/tests/lettuce/configurations/nsec3/nsec3_auth.config
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [
{
@@ -27,7 +27,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": {"kind": "needed", "special": "auth"},
"b10-cmdctl": {"kind": "needed", "special": "cmdctl"}
diff --git a/tests/lettuce/configurations/resolver/resolver_basic.config.orig b/tests/lettuce/configurations/resolver/resolver_basic.config.orig
index 0adca9f..fe5ddd0 100644
--- a/tests/lettuce/configurations/resolver/resolver_basic.config.orig
+++ b/tests/lettuce/configurations/resolver/resolver_basic.config.orig
@@ -1 +1,31 @@
-{"version": 2, "Logging": {"loggers": [{"severity": "DEBUG", "name": "*", "debuglevel": 99}]}, "Resolver": {"query_acl": [{"action": "REJECT", "from": "127.0.0.1"}], "listen_on": [{"port": 47806, "address": "127.0.0.1"}]}, "Boss": {"components": {"b10-resolver": {"kind": "needed"}, "b10-cmdctl": {"kind": "needed", "special": "cmdctl"}}}}
+{
+ "version": 3,
+ "Logging": {
+ "loggers": [ {
+ "severity": "DEBUG",
+ "name": "*",
+ "debuglevel": 99
+ } ]
+ },
+ "Resolver": {
+ "query_acl": [ {
+ "action": "REJECT",
+ "from": "127.0.0.1"
+ } ],
+ "listen_on": [ {
+ "port": 47806,
+ "address": "127.0.0.1"
+ } ]
+ },
+ "Init": {
+ "components": {
+ "b10-resolver": {
+ "kind": "needed"
+ },
+ "b10-cmdctl": {
+ "kind": "needed",
+ "special": "cmdctl"
+ }
+ }
+ }
+}
diff --git a/tests/lettuce/configurations/xfrin/inmem_slave.conf b/tests/lettuce/configurations/xfrin/inmem_slave.conf
index cc1c997..fedf372 100644
--- a/tests/lettuce/configurations/xfrin/inmem_slave.conf
+++ b/tests/lettuce/configurations/xfrin/inmem_slave.conf
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -30,7 +30,7 @@
]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
diff --git a/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig b/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig
index c04d917..1b2953d 100644
--- a/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig
+++ b/tests/lettuce/configurations/xfrin/retransfer_master.conf.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -36,7 +36,7 @@
"Stats": {
"poll-interval": 1
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-xfrout": { "address": "Xfrout", "kind": "dispensable" },
diff --git a/tests/lettuce/configurations/xfrin/retransfer_master_nons.conf.orig b/tests/lettuce/configurations/xfrin/retransfer_master_nons.conf.orig
index 80cc3db..bccadf7 100644
--- a/tests/lettuce/configurations/xfrin/retransfer_master_nons.conf.orig
+++ b/tests/lettuce/configurations/xfrin/retransfer_master_nons.conf.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -36,7 +36,7 @@
"Stats": {
"poll-interval": 1
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-xfrout": { "address": "Xfrout", "kind": "dispensable" },
diff --git a/tests/lettuce/configurations/xfrin/retransfer_slave.conf.orig b/tests/lettuce/configurations/xfrin/retransfer_slave.conf.orig
index cef04cf..2e6b17f 100644
--- a/tests/lettuce/configurations/xfrin/retransfer_slave.conf.orig
+++ b/tests/lettuce/configurations/xfrin/retransfer_slave.conf.orig
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -24,7 +24,7 @@
}]
}
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
diff --git a/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf b/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf
index d977c58..a5c22b1 100644
--- a/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf
+++ b/tests/lettuce/configurations/xfrin/retransfer_slave_notify.conf
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"Logging": {
"loggers": [ {
"debuglevel": 99,
@@ -37,7 +37,7 @@
"class": "IN"
} ]
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": { "kind": "needed", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
diff --git a/tests/lettuce/data/commands/bad_command b/tests/lettuce/data/commands/bad_command
index 95d1694..2daa7cb 100644
--- a/tests/lettuce/data/commands/bad_command
+++ b/tests/lettuce/data/commands/bad_command
@@ -1,8 +1,8 @@
!echo shouldshow
# just add something so the test can verify it's reverted
-config add /Boss/components b10-auth
-config set /Boss/components/b10-auth/kind needed
-config set /Boss/components/b10-auth/special auth
+config add /Init/components b10-auth
+config set /Init/components/b10-auth/kind needed
+config set /Init/components/b10-auth/special auth
bad command
# this should not be reached
!echo shouldnotshow
diff --git a/tests/lettuce/features/bindctl_commands.feature b/tests/lettuce/features/bindctl_commands.feature
index 57406c3..b9fef82 100644
--- a/tests/lettuce/features/bindctl_commands.feature
+++ b/tests/lettuce/features/bindctl_commands.feature
@@ -7,7 +7,7 @@ Feature: control with bindctl
# a number of modules. It then removes all non-essential modules,
# and checks whether they do disappear from the list of running
# modules (note that it 'misuses' the help command for this,
- # there is a Boss command 'show_processes' but it's output is
+ # there is a Init command 'show_processes' but it's output is
# currently less standardized than 'help')
Given I have bind10 running with configuration bindctl_commands.config
And wait for bind10 stderr message BIND10_STARTED_CC
@@ -19,7 +19,7 @@ Feature: control with bindctl
And wait for bind10 stderr message STATS_STARTING
And wait for bind10 stderr message STATSHTTPD_STARTED
- Then remove bind10 configuration Boss/components/NOSUCHMODULE
+ Then remove bind10 configuration Init/components/NOSUCHMODULE
last bindctl output should contain Error
bind10 module Xfrout should be running
@@ -30,29 +30,29 @@ Feature: control with bindctl
bind10 module StatsHttpd should be running
bind10 module Resolver should not be running
- Then remove bind10 configuration Boss/components value b10-xfrout
+ Then remove bind10 configuration Init/components value b10-xfrout
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
last bindctl output should not contain Error
# assuming it won't error for further modules (if it does, the final
# 'should not be running' tests would fail anyway)
- Then remove bind10 configuration Boss/components value b10-stats-httpd
+ Then remove bind10 configuration Init/components value b10-stats-httpd
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
last bindctl output should not contain Error
- Then remove bind10 configuration Boss/components value b10-stats
+ Then remove bind10 configuration Init/components value b10-stats
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
last bindctl output should not contain Error
- Then remove bind10 configuration Boss/components value b10-zonemgr
+ Then remove bind10 configuration Init/components value b10-zonemgr
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
last bindctl output should not contain Error
- Then remove bind10 configuration Boss/components value b10-xfrin
+ Then remove bind10 configuration Init/components value b10-xfrin
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
last bindctl output should not contain Error
- Then remove bind10 configuration Boss/components value b10-auth
+ Then remove bind10 configuration Init/components value b10-auth
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
last bindctl output should not contain Error
@@ -103,7 +103,7 @@ Feature: control with bindctl
last bindctl output should not contain shouldnotshow
# This would fail if the entire list was passed, or the configuration
# was committed
- send bind10 the command config show Boss/components
+ send bind10 the command config show Init/components
last bindctl output should not contain b10-auth
# nested_command contains another execute script
@@ -124,8 +124,8 @@ Feature: control with bindctl
When I send bind10 the command execute init_authoritative_server show
# just test some parts of the output
- last bindctl output should contain /Boss/components/b10-auth/special
- last bindctl output should contain /Boss/components/b10-zonemgr/kind
+ last bindctl output should contain /Init/components/b10-auth/special
+ last bindctl output should contain /Init/components/b10-zonemgr/kind
last bindctl output should contain Please
# nothing should have been changed
diff --git a/tests/lettuce/features/ddns_system.feature b/tests/lettuce/features/ddns_system.feature
index 8e279a7..184c8ae 100644
--- a/tests/lettuce/features/ddns_system.feature
+++ b/tests/lettuce/features/ddns_system.feature
@@ -48,7 +48,7 @@ Feature: DDNS System
And wait for new bind10 stderr message DDNS_STOPPED
# Test 7
- # BoB should restart it
+ # Init should restart it
And wait for new bind10 stderr message DDNS_STARTED
# Test 8
@@ -65,7 +65,7 @@ Feature: DDNS System
# Test 9
When I send bind10 the command Auth shutdown
And wait for new bind10 stderr message AUTH_SHUTDOWN
- # BoB should restart it automatically
+ # Init should restart it automatically
And wait for new bind10 stderr message AUTH_SERVER_STARTED
# Test 10
diff --git a/tests/lettuce/features/default.feature b/tests/lettuce/features/default.feature
index ce7ee1e..bd81f12 100644
--- a/tests/lettuce/features/default.feature
+++ b/tests/lettuce/features/default.feature
@@ -8,7 +8,7 @@ Feature: default bind10 config
And wait for bind10 stderr message STATS_STARTING
# These should be running
- bind10 module Boss should be running
+ bind10 module Init should be running
And bind10 module Logging should be running
And bind10 module Stats should be running
diff --git a/tests/lettuce/features/multi_instance.feature b/tests/lettuce/features/multi_instance.feature
index 4ce135a..3ab06eb 100644
--- a/tests/lettuce/features/multi_instance.feature
+++ b/tests/lettuce/features/multi_instance.feature
@@ -34,7 +34,7 @@ Feature: Multiple instances
If I remember the pid of process b10-auth
And remember the pid of process b10-auth-2
- When I remove bind10 configuration Boss/components value b10-auth-2
+ When I remove bind10 configuration Init/components value b10-auth-2
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
Then the pid of process b10-auth should not have changed
@@ -42,9 +42,9 @@ Feature: Multiple instances
When I send bind10 the following commands
"""
- config add Boss/components b10-auth-2
- config set Boss/components/b10-auth-2/special auth
- config set Boss/components/b10-auth-2/kind needed
+ config add Init/components b10-auth-2
+ config set Init/components/b10-auth-2/special auth
+ config set Init/components/b10-auth-2/kind needed
config commit
"""
And wait for new bind10 stderr message AUTH_SERVER_STARTED
@@ -53,7 +53,7 @@ Feature: Multiple instances
Then the pid of process b10-auth should not have changed
A query for example.com should have rcode REFUSED
- When I remove bind10 configuration Boss/components value b10-auth
+ When I remove bind10 configuration Init/components value b10-auth
And wait for new bind10 stderr message BIND10_PROCESS_ENDED
Then the pid of process b10-auth-2 should not have changed
A query for example.com should have rcode REFUSED
diff --git a/tests/lettuce/features/terrain/bind10_control.py b/tests/lettuce/features/terrain/bind10_control.py
index 142a78e..7cc7d3e 100644
--- a/tests/lettuce/features/terrain/bind10_control.py
+++ b/tests/lettuce/features/terrain/bind10_control.py
@@ -202,28 +202,28 @@ def parse_bindctl_output_as_data_structure():
"parseable data structure: '" + output + "': " + str(ve)
def find_process_pid(step, process_name):
- """Helper function to request the running processes from Boss, and
+ """Helper function to request the running processes from Init, and
return the pid of the process with the given process_name.
- Fails with an assert if the response from boss is not valid JSON,
+ Fails with an assert if the response from b10-init is not valid JSON,
or if the process with the given name is not found.
"""
# show_processes output is a list of lists, where the inner lists
# are of the form [ pid, "name" ]
# Not checking data form; errors will show anyway (if these turn
# out to be too vague, we can change this)
- step.given('send bind10 the command Boss show_processes')
+ step.given('send bind10 the command Init show_processes')
running_processes = parse_bindctl_output_as_data_structure()
for process in running_processes:
if process[1] == process_name:
return process[0]
assert False, "Process named " + process_name +\
- " not found in output of Boss show_processes";
+ " not found in output of Init show_processes";
@step("remember the pid of process ([\S]+)")
def remember_pid(step, process_name):
"""Stores the PID of the process with the given name as returned by
- Boss show_processes command.
+ Init show_processes command.
Fails if the process with the given name does not appear to exist.
Stores the component_name->pid value in the dict world.process_pids.
This should only be used by the related step
@@ -239,7 +239,7 @@ def remember_pid(step, process_name):
@step('pid of process ([\S]+) should not have changed')
def check_pid(step, process_name):
"""Checks the PID of the process with the given name as returned by
- Boss show_processes command.
+ Init show_processes command.
Fails if the process with the given name does not appear to exist.
Fails if the process with the given name exists, but has a different
pid than it had when the step 'remember the pid of process' was
@@ -343,9 +343,9 @@ def configure_ddns_on(step):
step.behave_as("""
When I send bind10 the following commands
\"\"\"
- config add Boss/components b10-ddns
- config set Boss/components/b10-ddns/kind dispensable
- config set Boss/components/b10-ddns/address DDNS
+ config add Init/components b10-ddns
+ config set Init/components/b10-ddns/kind dispensable
+ config set Init/components/b10-ddns/address DDNS
config commit
\"\"\"
""")
@@ -358,7 +358,7 @@ def configure_ddns_off(step):
step.behave_as("""
When I send bind10 the following commands
\"\"\"
- config remove Boss/components b10-ddns
+ config remove Init/components b10-ddns
config commit
\"\"\"
""")
diff --git a/tests/system/bindctl/tests.sh b/tests/system/bindctl/tests.sh
index 75c91de..ca58240 100755
--- a/tests/system/bindctl/tests.sh
+++ b/tests/system/bindctl/tests.sh
@@ -38,8 +38,8 @@ if [ $status != 0 ]; then echo "I:failed"; fi
n=`expr $n + 1`
echo "I:Starting b10-auth and checking that it works ($n)"
-echo 'config add Boss/components b10-auth
-config set Boss/components/b10-auth { "special": "auth", "kind": "needed" }
+echo 'config add Init/components b10-auth
+config set Init/components/b10-auth { "special": "auth", "kind": "needed" }
config commit
quit
' | $RUN_BINDCTL \
@@ -68,7 +68,7 @@ if [ $status != 0 ]; then echo "I:failed"; fi
n=`expr $n + 1`
echo "I:Stopping b10-auth and checking that ($n)"
-echo 'config remove Boss/components b10-auth
+echo 'config remove Init/components b10-auth
config commit
quit
' | $RUN_BINDCTL \
@@ -79,8 +79,8 @@ if [ $status != 0 ]; then echo "I:failed"; fi
n=`expr $n + 1`
echo "I:Restarting b10-auth and checking that ($n)"
-echo 'config add Boss/components b10-auth
-config set Boss/components/b10-auth { "special": "auth", "kind": "needed" }
+echo 'config add Init/components b10-auth
+config set Init/components/b10-auth { "special": "auth", "kind": "needed" }
config commit
quit
' | $RUN_BINDCTL \
@@ -143,8 +143,8 @@ n=`expr $n + 1`
echo "I:Starting more b10-auths and checking that ($n)"
for i in 2 3
do
- echo 'config add Boss/components b10-auth-'$i'
-config set Boss/components/b10-auth-'$i' { "special": "auth", "kind": "needed" }
+ echo 'config add Init/components b10-auth-'$i'
+config set Init/components/b10-auth-'$i' { "special": "auth", "kind": "needed" }
config commit
quit
' | $RUN_BINDCTL \
@@ -180,7 +180,7 @@ n=`expr $n + 1`
echo "I:Stopping extra b10-auths and checking that ($n)"
for i in 3 2
do
- echo 'config remove Boss/components b10-auth-'$i'
+ echo 'config remove Init/components b10-auth-'$i'
config commit
quit
' | $RUN_BINDCTL \
diff --git a/tests/system/glue/nsx1/b10-config.db.in b/tests/system/glue/nsx1/b10-config.db.in
index 5f93f3b..6802c53 100644
--- a/tests/system/glue/nsx1/b10-config.db.in
+++ b/tests/system/glue/nsx1/b10-config.db.in
@@ -23,7 +23,7 @@
}
]
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": {"kind": "needed", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
diff --git a/tests/system/ixfr/b10-config.db.in b/tests/system/ixfr/b10-config.db.in
index b3b27a4..a36117d 100644
--- a/tests/system/ixfr/b10-config.db.in
+++ b/tests/system/ixfr/b10-config.db.in
@@ -38,7 +38,7 @@
"class": "IN"
}]
},
- "Boss": {
+ "Init": {
"components": {
"b10-auth": {"kind": "needed", "special": "auth" },
"b10-xfrin": { "address": "Xfrin", "kind": "dispensable" },
More information about the bind10-changes
mailing list