def __init__(self): super(HandleHost, self).__init__() self.my_hostname = socket.gethostname() self.xml_parser = parse_cib_xml.ParseCibXml() self.crmmon_xml_parser = parse_crmmon_xml.ParseCrmMonXml() self.status_holder = hold_host_status.HostHoldStatus() self.notifier = masakari.SendNotification()
def test_send_notification_409_error( self, mock_password, mock_session, mock_connection): mock_conn = mock.Mock() mock_conn.instance_ha.return_value = mock.Mock() mock_conn.instance_ha.create_notification.return_value = mock.Mock() mock_connection.return_value = mock_conn # TODO(samP): Remove attribute check and else case if # openstacksdk is bumped up from '>=0.9.19' to '>=0.10.0' # in global-requirements. if hasattr(exceptions.HttpException(), 'status_code'): response = FakeResponse(status_code=409) status_ex = exceptions.HttpException(response=response) else: status_ex = exceptions.HttpException(http_status=409) mock_conn.instance_ha.create_notification.side_effect = status_ex notifier = masakari.SendNotification() notifier.send_notification( self.api_retry_max, self.api_retry_interval, self.event) mock_conn.instance_ha.create_notification.assert_called_once_with( type=self.event['notification']['type'], hostname=self.event['notification']['hostname'], generated_time=self.event['notification']['generated_time'], payload=self.event['notification']['payload'])
def test_send_notification_500_error(self, mock_auth, mock_session, mock_connection, mock_sleep): mock_conn = mock.Mock() mock_conn.instance_ha.return_value = mock.Mock() mock_conn.instance_ha.create_notification.return_value = mock.Mock() mock_connection.return_value = mock_conn response = FakeResponse(status_code=500) status_ex = exceptions.HttpException(response=response) mock_conn.instance_ha.create_notification.side_effect = status_ex mock_sleep.return_value = None notifier = masakari.SendNotification() notifier.send_notification(self.api_retry_max, self.api_retry_interval, self.event) mock_conn.instance_ha.create_notification.assert_called_with( type=self.event['notification']['type'], hostname=self.event['notification']['hostname'], generated_time=self.event['notification']['generated_time'], payload=self.event['notification']['payload']) self.assertEqual(self.api_retry_max + 1, mock_conn.instance_ha.create_notification.call_count)
def test_send_notification_500_error(self, mock_password, mock_session, mock_service_description, mock_connection, mock_sleep): mock_conn = mock.Mock() mock_client = mock.Mock() mock_conn.ha.proxy_class.return_value = mock_client mock_connection.return_value = mock_conn # TODO(samP): Remove attribute check and else case if # openstacksdk is bumped up from '>=0.9.19' to '>=0.10.0' # in global-requirements. if hasattr(exceptions.HttpException(), 'status_code'): response = FakeResponse(status_code=500) status_ex = exceptions.HttpException(response=response) else: status_ex = exceptions.HttpException(http_status=500) mock_client.create_notification.side_effect = status_ex mock_sleep.return_value = None notifier = masakari.SendNotification() notifier.send_notification( self.api_retry_max, self.api_retry_interval, self.event) mock_client.create_notification.assert_called_with( type=self.event['notification']['type'], hostname=self.event['notification']['hostname'], generated_time=self.event['notification']['generated_time'], payload=self.event['notification']['payload']) self.assertEqual(self.api_retry_max + 1, mock_client.create_notification.call_count)
def __init__(self): super(ConsulCheck, self).__init__() self.hostname = socket.gethostname() self.monitoring_interval = CONF.host.monitoring_interval self.monitoring_samples = CONF.host.monitoring_samples self.matrix_manager = matrix_helper.MatrixManager(CONF) self.consul_manager = consul_helper.ConsulManager(CONF) self.notifier = masakari.SendNotification() self._matrix = None self._sequence = None self.monitoring_data = {} self.last_host_health = {}
def test_send_notification( self, mock_password, mock_session, mock_connection): mock_conn = mock.Mock() mock_conn.instance_ha.return_value = mock.Mock() mock_conn.instance_ha.create_notification.return_value = mock.Mock() mock_connection.return_value = mock_conn notifier = masakari.SendNotification() notifier.send_notification( self.api_retry_max, self.api_retry_interval, self.event) mock_conn.instance_ha.create_notification.assert_called_once_with( type=self.event['notification']['type'], hostname=self.event['notification']['hostname'], generated_time=self.event['notification']['generated_time'], payload=self.event['notification']['payload'])
def __init__(self): self.process_list = None self.restart_failure_list = [] self.notifier = masakari.SendNotification()
def __init__(self): super(QemuGuestAgent, self).__init__() self.notifier = masakari.SendNotification()
def __init__(self): self.notifier = masakari.SendNotification()