Browse Source

[213] Remove started_*_family variables

They were redundant and currently the same is done by the Configurator
implicitly.

As a result, the messages about starting something as non-root are
specific to each component and happen even on restart.
Michal 'vorner' Vaner 13 years ago
parent
commit
6d2960ff38
2 changed files with 21 additions and 26 deletions
  1. 9 2
      src/bin/bind10/bind10_messages.mes
  2. 12 24
      src/bin/bind10/bind10_src.py.in

+ 9 - 2
src/bin/bind10/bind10_messages.mes

@@ -270,8 +270,15 @@ 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
 Boss process and the processes it starts.  This error is output when a
 message received by the Boss process is not recognised.
 message received by the Boss process is not recognised.
 
 
-% BIND10_START_AS_NON_ROOT starting %1 as a user, not root. This might fail.
-The given module is being started or restarted without root privileges.
+% BIND10_START_AS_NON_ROOT_AUTH starting b10-auth as a user, not root. This might fail.
+The authoritative server is being started or restarted without root privileges.
+If the module needs these privileges, it may have problems starting.
+Note that this issue should be resolved by the pending 'socket-creator'
+process; once that has been implemented, modules should not need root
+privileges anymore. See tickets #800 and #801 for more information.
+
+% BIND10_START_AS_NON_ROOT_RESOLVER starting b10-resolver as a user, not root. This might fail.
+The resolver is being started or restarted without root privileges.
 If the module needs these privileges, it may have problems starting.
 If the module needs these privileges, it may have problems starting.
 Note that this issue should be resolved by the pending 'socket-creator'
 Note that this issue should be resolved by the pending 'socket-creator'
 process; once that has been implemented, modules should not need root
 process; once that has been implemented, modules should not need root

+ 12 - 24
src/bin/bind10/bind10_src.py.in

@@ -246,8 +246,6 @@ class BoB:
         self.cfg_start_resolver = False
         self.cfg_start_resolver = False
         self.cfg_start_dhcp6 = False
         self.cfg_start_dhcp6 = False
         self.cfg_start_dhcp4 = False
         self.cfg_start_dhcp4 = False
-        self.started_auth_family = False
-        self.started_resolver_family = False
         self.curproc = None
         self.curproc = None
         self.dead_processes = {}
         self.dead_processes = {}
         self.msgq_socket_file = msgq_socket_file
         self.msgq_socket_file = msgq_socket_file
@@ -313,28 +311,20 @@ class BoB:
         # Now we declare few functions used only internally here. Besides the
         # Now we declare few functions used only internally here. Besides the
         # benefit of not polluting the name space, they are closures, so we
         # benefit of not polluting the name space, they are closures, so we
         # don't need to pass some variables
         # don't need to pass some variables
-        def start_stop(name, started, start, stop):
-            if not'start_' + name in new_config:
-                return
-            if new_config['start_' + name]:
-                if not started:
-                    if self.uid is not None:
-                        logger.info(BIND10_START_AS_NON_ROOT, name)
+        def start_stop(name, start, stop):
+            if 'start_' + name in new_config:
+                if new_config['start_' + name]:
                     start()
                     start()
-            else:
-                stop()
+                else:
+                    stop()
         # These four functions are passed to start_stop (smells like functional
         # These four functions are passed to start_stop (smells like functional
         # programming little bit)
         # programming little bit)
         def resolver_on():
         def resolver_on():
             self.component_config['b10-resolver'] = { 'kind': 'needed',
             self.component_config['b10-resolver'] = { 'kind': 'needed',
                                                       'special': 'resolver' }
                                                       'special': 'resolver' }
-            self.__propagate_component_config(self.component_config)
-            self.started_resolver_family = True
         def resolver_off():
         def resolver_off():
             if 'b10-resolver' in self.component_config:
             if 'b10-resolver' in self.component_config:
                 del self.component_config['b10-resolver']
                 del self.component_config['b10-resolver']
-            self.__propagate_component_config(self.component_config)
-            self.started_resolver_family = False
         def auth_on():
         def auth_on():
             self.component_config['b10-auth'] = { 'kind': 'needed',
             self.component_config['b10-auth'] = { 'kind': 'needed',
                                                   'special': 'auth' }
                                                   'special': 'auth' }
@@ -344,8 +334,6 @@ class BoB:
                                                    'special': 'xfrin' }
                                                    'special': 'xfrin' }
             self.component_config['b10-zonemgr'] = { 'kind': 'dispensable',
             self.component_config['b10-zonemgr'] = { 'kind': 'dispensable',
                                                      'address': 'Zonemgr' }
                                                      'address': 'Zonemgr' }
-            self.__propagate_component_config(self.component_config)
-            self.started_auth_family = True
         def auth_off():
         def auth_off():
             if 'b10-zonemgr' in self.component_config:
             if 'b10-zonemgr' in self.component_config:
                 del self.component_config['b10-zonemgr']
                 del self.component_config['b10-zonemgr']
@@ -355,15 +343,13 @@ class BoB:
                 del self.component_config['b10-xfrout']
                 del self.component_config['b10-xfrout']
             if 'b10-auth' in self.component_config:
             if 'b10-auth' in self.component_config:
                 del self.component_config['b10-auth']
                 del self.component_config['b10-auth']
-            self.__propagate_component_config(self.component_config)
-            self.started_auth_family = False
 
 
         # The real code of the config handler function follows here
         # The real code of the config handler function follows here
         logger.debug(DBG_COMMANDS, BIND10_RECEIVED_NEW_CONFIGURATION,
         logger.debug(DBG_COMMANDS, BIND10_RECEIVED_NEW_CONFIGURATION,
                      new_config)
                      new_config)
-        start_stop('resolver', self.started_resolver_family, resolver_on,
-                   resolver_off)
-        start_stop('auth', self.started_auth_family, auth_on, auth_off)
+        start_stop('resolver', resolver_on, resolver_off)
+        start_stop('auth', auth_on, auth_off)
+        self.__propagate_component_config(self.component_config)
 
 
         answer = isc.config.ccsession.create_answer(0)
         answer = isc.config.ccsession.create_answer(0)
         return answer
         return answer
@@ -652,6 +638,8 @@ class BoB:
         """
         """
             Start the Authoritative server
             Start the Authoritative server
         """
         """
+        if self.uid is not None and self.__started:
+            logger.warn(BIND10_START_AS_NON_ROOT_AUTH)
         authargs = ['b10-auth']
         authargs = ['b10-auth']
         if self.nocache:
         if self.nocache:
             authargs += ['-n']
             authargs += ['-n']
@@ -669,6 +657,8 @@ class BoB:
             are pure speculation.  As with the auth daemon, they should be
             are pure speculation.  As with the auth daemon, they should be
             read from the configuration database.
             read from the configuration database.
         """
         """
+        if self.uid is not None and self.__started:
+            logger.warn(BIND10_START_AS_NON_ROOT_RESOLVER)
         self.curproc = "b10-resolver"
         self.curproc = "b10-resolver"
         # XXX: this must be read from the configuration manager in the future
         # XXX: this must be read from the configuration manager in the future
         resargs = ['b10-resolver']
         resargs = ['b10-resolver']
@@ -751,7 +741,6 @@ class BoB:
         if self.cfg_start_resolver:
         if self.cfg_start_resolver:
             component_config['b10-resolver'] = { 'kind': 'needed',
             component_config['b10-resolver'] = { 'kind': 'needed',
                                                  'special': 'resolver' }
                                                  'special': 'resolver' }
-            self.started_resolver_family = True
             self.__propagate_component_config(component_config)
             self.__propagate_component_config(component_config)
 
 
         # Everything after the main components can run as non-root.
         # Everything after the main components can run as non-root.
@@ -770,7 +759,6 @@ class BoB:
             component_config['b10-zonemgr'] = { 'kind': 'dispensable',
             component_config['b10-zonemgr'] = { 'kind': 'dispensable',
                                               'address': 'Zonemgr' }
                                               'address': 'Zonemgr' }
             self.__propagate_component_config(component_config)
             self.__propagate_component_config(component_config)
-            self.started_auth_family = True
 
 
         # ... and finally start the remaining processes
         # ... and finally start the remaining processes
         component_config['b10-stats'] = { 'kind': 'dispensable',
         component_config['b10-stats'] = { 'kind': 'dispensable',