示例#1
0
 def test_instance_systemctl(self, mock_systemctl):
     mock_systemctl.return_value = True
     self.mock_runner.run.return_value = ("", "", 0)
     lib.start_service(self.mock_runner, self.service, instance="test")
     self.mock_runner.run.assert_called_once_with([
         _systemctl, "start", "{0}@{1}.service".format(self.service, "test")
     ])
示例#2
0
 def test_not_systemctl(self, mock_systemctl):
     mock_systemctl.return_value = False
     self.mock_runner.run.return_value = ("", 0)
     lib.start_service(self.mock_runner, self.service)
     self.mock_runner.run.assert_called_once_with(
         ["service", self.service, "start"]
     )
示例#3
0
 def test_instance_not_systemctl(self, mock_systemctl):
     mock_systemctl.return_value = False
     self.mock_runner.run.return_value = ("Starting...", "", 0)
     lib.start_service(self.mock_runner, self.service, instance="test")
     self.mock_runner.run.assert_called_once_with(
         [_service, self.service, "start"]
     )
示例#4
0
 def test_systemctl(self, mock_systemctl):
     mock_systemctl.return_value = True
     self.mock_runner.run.return_value = ("", "", 0)
     lib.start_service(self.mock_runner, self.service)
     self.mock_runner.run.assert_called_once_with(
         [_systemctl, "start", self.service + ".service"]
     )
示例#5
0
 def test_not_systemctl_failed(self, mock_systemctl):
     mock_systemctl.return_value = False
     self.mock_runner.run.return_value = ("", 1)
     self.assertRaises(
         lib.StartServiceError,
         lambda: lib.start_service(self.mock_runner, self.service)
     )
     self.mock_runner.run.assert_called_once_with(
         ["service", self.service, "start"]
     )
示例#6
0
文件: booth.py 项目: tomjelinek/pcs
def start_booth(env):
    """
    Start specified instance of booth service. Currently it is supported only
    systemd systems. On non systems it can be run like this:
        BOOTH_CONF_FILE=<booth-file-path> /etc/initd/booth-arbitrator

    env -- LibraryEnvironment
    """
    external.ensure_is_systemd()
    name = env.booth.name
    try:
        external.start_service(env.cmd_runner(), "booth", name)
    except external.StartServiceError as e:
        raise LibraryError(reports.service_start_error(
            "booth", e.message, instance=name
        ))
    env.report_processor.process(reports.service_start_success(
        "booth", instance=name
    ))
示例#7
0
def qdevice_start(runner):
    """
    start qdevice now on local host
    """
    external.start_service(runner, __service_name)
示例#8
0
def qdevice_start(runner):
    """
    start qdevice now on local host
    """
    external.start_service(runner, __service_name)
示例#9
0
 def test_instance_not_systemctl(self, mock_systemctl):
     mock_systemctl.return_value = False
     self.mock_runner.run.return_value = ("Starting...", "", 0)
     lib.start_service(self.mock_runner, self.service, instance="test")
     self.mock_runner.run.assert_called_once_with(
         [_service, self.service, "start"])
示例#10
0
 def test_systemctl(self, mock_systemctl):
     mock_systemctl.return_value = True
     self.mock_runner.run.return_value = ("", "", 0)
     lib.start_service(self.mock_runner, self.service)
     self.mock_runner.run.assert_called_once_with(
         [_systemctl, "start", self.service + ".service"])