From: Michal 'vorner' Vaner Date: Tue, 11 Jun 2013 09:11:02 +0000 (+0200) Subject: [2922] More line wrapping X-Git-Tag: bind10-1.2.0beta1-release~406^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e12bb75e5e456ecaaa738936aea36fc255d342f7;p=thirdparty%2Fkea.git [2922] More line wrapping --- diff --git a/src/bin/bind10/init.py.in b/src/bin/bind10/init.py.in index eac5e5486d..3bb7ea7946 100755 --- a/src/bin/bind10/init.py.in +++ b/src/bin/bind10/init.py.in @@ -89,7 +89,8 @@ logger = isc.log.Logger("init") 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 +# 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" @@ -200,7 +201,8 @@ class Init: 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). + 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 @@ -223,12 +225,13 @@ class Init: 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 inappropriate. 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. + # name "components" may be inappropriate. 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 @@ -351,7 +354,8 @@ class Init: def command_handler(self, command, args): logger.debug(DBG_COMMANDS, BIND10_RECEIVED_COMMAND, command) - answer = isc.config.ccsession.create_answer(1, "command not implemented") + answer = isc.config.ccsession.create_answer(1, + "command not implemented") if type(command) != str: answer = isc.config.ccsession.create_answer(1, "bad command") else: @@ -440,7 +444,8 @@ class Init: 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) + logger.debug(DBG_PROCESS, BIND10_STARTED_PROCESS_PID, self.curproc, + pid) def process_running(self, msg, who): """ @@ -499,7 +504,8 @@ class Init: 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") + raise CChannelConnectError("Unable to connect to c-channel " + + "after 5 seconds") # try to connect, and if we can't wait a short while try: @@ -507,8 +513,8 @@ class Init: 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. + # 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") @@ -516,9 +522,9 @@ class Init: def wait_msgq(self): """ - Wait for the message queue to fully start. It does so only after the - config manager connects to it. We know it is ready when it starts - answering commands. + Wait for the message queue to fully start. It does so only after + the config manager connects to it. We know it is ready when it + starts answering commands. We don't add a specific command for it here, an error response is as good as positive one to know it is alive. @@ -530,7 +536,8 @@ class Init: while time_remaining > 0 and retry: try: self.ccs.rpc_call('AreYouThere?', 'Msgq') - # We don't expect this to succeed. If it does, it's programmer error + # We don't expect this to succeed. If it does, it's programmer + # error raise Exception("Non-existing RPC call succeeded") except isc.config.RPCRecipientMissing: retry = True # Not there yet @@ -565,14 +572,16 @@ class Init: # 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"): + 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") + raise ProcessStartError("Configuration manager process has not " + + "started") return bind_cfgd @@ -596,7 +605,8 @@ class Init: # A couple of utility methods for starting processes... - def start_process(self, name, args, c_channel_env, port=None, address=None): + 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 @@ -641,9 +651,9 @@ class Init: # 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. + # 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): """ @@ -722,7 +732,8 @@ class Init: 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" + 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 @@ -981,8 +992,8 @@ class Init: 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 + 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. @@ -1154,9 +1165,12 @@ def parse_args(args=sys.argv[1:], Parser=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") + 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") + 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", @@ -1180,7 +1194,9 @@ def parse_args(args=sys.argv[1:], Parser=OptionParser): 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") + default=10, + help="Time (in seconds) to wait for config manager to " + "start up") (options, args) = parser.parse_args(args)