def test_success(self): mock_communicator = mock.MagicMock(spec_set=NodeCommunicator) node = NodeAddresses("node1") lib_sbd.check_sbd(mock_communicator, node, "/dev/watchdog") mock_communicator.call_node.assert_called_once_with( node, "remote/check_sbd", "watchdog=%2Fdev%2Fwatchdog" )
def test_success(self): mock_communicator = mock.MagicMock(spec_set=NodeCommunicator) node = NodeAddresses("node1") lib_sbd.check_sbd(mock_communicator, node, "/dev/watchdog", ["/dev/sdb1", "/dev/sdc"]) mock_communicator.call_node.assert_called_once_with( node, "remote/check_sbd", "watchdog=%2Fdev%2Fwatchdog&" +\ "device_list=%5B%22%2Fdev%2Fsdb1%22%2C+%22%2Fdev%2Fsdc%22%5D" )
def get_sbd_status(node): try: status_list.append({ "node": node.label, "status": json.loads( # here we just need info about sbd service, # therefore watchdog and device list is empty sbd.check_sbd(lib_env.node_communicator(), node, "", []))["sbd"] }) successful_node_list.append(node) except NodeCommunicationException as e: report_item_list.append( node_communicator_exception_to_report_item( e, severity=Severities.WARNING)) report_item_list.append( reports.unable_to_get_sbd_status( node.label, "", #reason is in previous report item #warning is there implicit )) except (ValueError, KeyError) as e: report_item_list.append( reports.unable_to_get_sbd_status(node.label, str(e)))
def get_sbd_status(node): try: status_list.append({ "node": node, "status": json.loads( sbd.check_sbd(lib_env.node_communicator(), node, "") )["sbd"] }) successful_node_list.append(node) except NodeCommunicationException as e: report_item_list.append(reports.unable_to_get_sbd_status( node.label, node_communicator_exception_to_report_item(e).message )) except (ValueError, KeyError) as e: report_item_list.append(reports.unable_to_get_sbd_status( node.label, str(e) ))
def get_sbd_status(node): try: status_list.append({ "node": node, "status": json.loads( sbd.check_sbd(lib_env.node_communicator(), node, "") )["sbd"] }) successful_node_list.append(node) except NodeCommunicationException as e: report_item_list.append(node_communicator_exception_to_report_item( e, severity=Severities.WARNING )) report_item_list.append(reports.unable_to_get_sbd_status( node.label, "", #reason is in previous report item #warning is there implicit )) except (ValueError, KeyError) as e: report_item_list.append(reports.unable_to_get_sbd_status( node.label, str(e) ))
def test_success(self): mock_communicator = mock.MagicMock(spec_set=NodeCommunicator) node = NodeAddresses("node1") lib_sbd.check_sbd(mock_communicator, node, "/dev/watchdog") mock_communicator.call_node.assert_called_once_with( node, "remote/check_sbd", "watchdog=%2Fdev%2Fwatchdog")