Skip to content

Commit b732c62

Browse files
authored
Revert [NDMII-3310] add support for HA for integrations (#19671)
1 parent 7551df9 commit b732c62

File tree

3 files changed

+2
-31
lines changed

3 files changed

+2
-31
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove HA_SUPPORTED as a class attribute to the AgentCheck to let integrations self declare that they support HA.

datadog_checks_base/datadog_checks/base/checks/base.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ class except the `check` method but sometimes it might be useful for a Check to
164164
# See https://github.com/DataDog/integrations-core/pull/2093 for more information.
165165
DEFAULT_METRIC_LIMIT = 0
166166

167-
HA_SUPPORTED = False
168-
169167
# Allow tracing for classic integrations
170168
def __init_subclass__(cls, *args, **kwargs):
171169
try:
@@ -314,14 +312,6 @@ def __init__(self, *args, **kwargs):
314312
if os.environ.get("GOFIPS", "0") == "1":
315313
enable_fips()
316314

317-
ha_enabled_init = self.init_config.get('ha_enabled', False) if self.init_config else False
318-
ha_enabled_instance = self.instance.get('ha_enabled', False) if self.instance else False
319-
320-
if not self.HA_SUPPORTED and (ha_enabled_init or ha_enabled_instance):
321-
raise ConfigurationError(
322-
f"High Availability is enabled for check {self.name} but this integration does not support it"
323-
)
324-
325315
def _create_metrics_pattern(self, metric_patterns, option_name):
326316
all_patterns = metric_patterns.get(option_name, [])
327317

datadog_checks_base/tests/base/checks/test_agent_check.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import mock
1212
import pytest
1313

14-
from datadog_checks.base import AgentCheck, ConfigurationError, to_native_string
14+
from datadog_checks.base import AgentCheck, to_native_string
1515
from datadog_checks.base import __version__ as base_package_version
1616

1717
from .utils import BaseModelTest
@@ -1310,23 +1310,3 @@ def test_env_var_logic_preset():
13101310
AgentCheck()
13111311
assert os.getenv('OPENSSL_CONF', None) == preset_conf
13121312
assert os.getenv('OPENSSL_MODULES', None) == preset_modules
1313-
1314-
1315-
def test_ha_enabled_and_unsupported():
1316-
class TestNonHACheck(AgentCheck):
1317-
HA_SUPPORTED = False
1318-
1319-
TestNonHACheck('test', {}, [{}])
1320-
with pytest.raises(ConfigurationError):
1321-
TestNonHACheck('test', {'ha_enabled': True}, [{}])
1322-
with pytest.raises(ConfigurationError):
1323-
TestNonHACheck('test', {}, [{'ha_enabled': True}])
1324-
1325-
1326-
def test_ha_enabled_and_supported():
1327-
class TestHACheck(AgentCheck):
1328-
HA_SUPPORTED = True
1329-
1330-
TestHACheck('test', {}, [{}])
1331-
TestHACheck('test', {'ha_enabled': True}, [{}])
1332-
TestHACheck('test', {}, [{'ha_enabled': True}])

0 commit comments

Comments
 (0)