def test_assess_status(self): with patch.object(nutils, 'assess_status_func') as asf: callee = MagicMock() asf.return_value = callee nutils.assess_status('test-config') asf.assert_called_once_with('test-config') callee.assert_called_once_with()
def test_assess_status(self): with patch.object(nutils, 'assess_status_func') as asf: callee = MagicMock() asf.return_value = callee nutils.assess_status('test-config') asf.assert_called_once_with('test-config') callee.assert_called_once_with() self.os_application_version_set.assert_called_with( nutils.VERSION_PACKAGE)
def run_deferred_hooks(args): """Run deferred hooks. :param args: Unused :type args: List[str] """ _run_deferred_hooks() os_utils.restart_services_action(deferred_only=True) assess_status(register_configs())
def test_assess_status(self): with patch.object(nutils, 'assess_status_func') as asf: callee = MagicMock() asf.return_value = callee nutils.assess_status('test-config') asf.assert_called_once_with('test-config') callee.assert_called_once_with() self.os_application_version_set.assert_called_with( nutils.VERSION_PACKAGE )
def restart(args): """Restart services. :param args: Unused :type args: List[str] """ deferred_only = action_get("deferred-only") services = action_get("services").split() # Check input if deferred_only and services: action_fail("Cannot set deferred-only and services") return if not (deferred_only or services): action_fail("Please specify deferred-only or services") return if action_get('run-hooks'): _run_deferred_hooks() if deferred_only: os_utils.restart_services_action(deferred_only=True) else: os_utils.restart_services_action(services=services) assess_status(register_configs())
def main(): try: hooks.execute(sys.argv) except UnregisteredHookError as e: log('Unknown hook {} - skipping.'.format(e)) assess_status(CONFIGS)