class Daemon(object):
    """Starts a daemon."""

    def __init__(self, alternate_path=None, conf_file_name=None,
                 extra_cmds=None, service_path_root=None, service_path=None):
        # The path to the daemon bin if the other one doesn't work.
        self.alternate_path = alternate_path
        self.extra_cmds = extra_cmds or []
        # The name of a test config value which points to a conf file.
        self.conf_file_name = conf_file_name
        # The name of a test config value, which is inserted into the service_path.
        self.service_path_root = service_path_root
        # The first path to the daemon bin we try.
        self.service_path = service_path or "%s"

    def run(self):
        # Print out everything to make it
        print("Looking for config value %s..." % self.service_path_root)
        print(CONFIG.values[self.service_path_root])
        path = self.service_path % CONFIG.values[self.service_path_root]
        print("Path = %s" % path)
        if not os.path.exists(path):
            path = self.alternate_path
        if path is None:
            fail("Could not find path to %s" % self.service_path_root)
        conf_path = str(CONFIG.values[self.conf_file_name])
        cmds = CONFIG.python_cmd_list() + [path] + self.extra_cmds + \
               [conf_path]
        print("Running cmds: %s" % cmds)
        self.service = Service(cmds)
        if not self.service.is_service_alive():
            self.service.start()
Ejemplo n.º 2
0
class Daemon(object):
    """Starts a daemon."""

    def __init__(self, alternate_path=None, conf_file_name=None,
                 extra_cmds=None, service_path_root=None, service_path=None):
        # The path to the daemon bin if the other one doesn't work.
        self.alternate_path = alternate_path
        self.extra_cmds = extra_cmds or []
        # The name of a test config value which points to a conf file.
        self.conf_file_name = conf_file_name
        # The name of a test config value, which is inserted into the service_path.
        self.service_path_root = service_path_root
        # The first path to the daemon bin we try.
        self.service_path = service_path or "%s"

    def run(self):
        # Print out everything to make it
        print("Looking for config value %s..." % self.service_path_root)
        print(CONFIG.values[self.service_path_root])
        path = self.service_path % CONFIG.values[self.service_path_root]
        print("Path = %s" % path)
        if not os.path.exists(path):
            path = self.alternate_path
        if path is None:
            fail("Could not find path to %s" % self.service_path_root)
        conf_path = str(CONFIG.values[self.conf_file_name])
        cmds = CONFIG.python_cmd_list() + [path] + self.extra_cmds + \
               [conf_path]
        print("Running cmds: %s" % cmds)
        self.service = Service(cmds)
        if not self.service.is_service_alive():
            self.service.start()
class KeystoneAll(unittest.TestCase):
    """Starts the Keystone combined daemon."""

    def setUp(self):
        path = keystone_bin("keystone-all")
        self.service = Service(python_cmd_list() + [path, "-c %s" % keystone_conf()])

    def test_start(self):
        if not self.service.is_service_alive():
            self.service.start()
class Reaper(unittest.TestCase):
    """Starts the Reaper."""

    def setUp(self):
        self.service = Service(
            python_cmd_list() + ["%s/bin/nova-reaper" % nova_code_root(), "--flagfile=%s" % nova_conf()]
        )

    def test_start(self):
        if not self.service.is_service_alive():
            self.service.start()
Ejemplo n.º 5
0
class Reaper(unittest.TestCase):
    """Starts the Reaper."""

    def setUp(self):
        self.service = Service(python_cmd_list() +
                               ["%s/bin/nova-reaper" % nova_code_root(),
                                "--flagfile=%s" % nova_conf()])

    def test_start(self):
        if not self.service.is_service_alive():
            self.service.start()
Ejemplo n.º 6
0
class KeystoneAll(unittest.TestCase):
    """Starts the Keystone combined daemon."""

    def setUp(self):
        path = keystone_bin("keystone-all")
        self.service = Service(python_cmd_list() +
                               [path, "-c %s" % keystone_conf()])

    def test_start(self):
        if not self.service.is_service_alive():
            self.service.start()