Commit bd93846c authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1901] Rename bob and BoB as well

parent 0a6fc5a8
......@@ -347,7 +347,7 @@ share/
share/bind10/
auth.spec
b10-cmdctl.pem
bob.spec
init.spec
passwd.csv
man/
var/
......
......@@ -5,7 +5,7 @@ Files:
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.
......
......@@ -16,7 +16,7 @@
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""
This file implements the Init of Bind (BoB, or bob) program.
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
......@@ -30,7 +30,7 @@ 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
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__.
......@@ -190,7 +190,7 @@ class CChannelConnectError(Exception): pass
class ProcessStartError(Exception): pass
class BoB:
class Init:
"""Init of BIND class."""
def __init__(self, msgq_socket_file=None, data_path=None,
......@@ -393,7 +393,7 @@ class BoB:
def _read_bind10_config(self):
"""
Reads the parameters associated with the BoB module itself.
Reads the parameters associated with the Init module itself.
This means the list of components we should start now.
......@@ -401,7 +401,7 @@ class BoB:
it stays because of historical reasons and because the tests
replace the method sometimes.
"""
logger.info(BIND10_READING_BOSS_CONFIGURATION)
logger.info(BIND10_READING_INIT_CONFIGURATION)
config_data = self.ccs.get_full_config()
self.__propagate_component_config(config_data['components'])
......@@ -673,7 +673,7 @@ class BoB:
def startup(self):
"""
Start the BoB instance.
Start the Init instance.
Returns None if successful, otherwise an string describing the
problem.
......@@ -740,7 +740,7 @@ class BoB:
self.runnable = False
def shutdown(self):
"""Stop the BoB instance."""
"""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
......@@ -1289,12 +1289,11 @@ def main():
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
try:
# Go bob!
b10_init = 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)
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)
......
# Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
IN# 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
......@@ -136,7 +136,7 @@ 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 b10-init configuration
% 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.
......
......@@ -18,13 +18,13 @@ BIND10_EXE="../run_bind10.sh"
TIMEOUT=3
class TestInitArgs(unittest.TestCase):
def _waitForString(self, bob, s):
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):
......@@ -34,52 +34,52 @@ class TestInitArgs(unittest.TestCase):
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 TestInitArgs(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 TestInitArgs(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 TestInitArgs(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 TestInitArgs(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()
This diff is collapsed.
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment