diff --git a/generic_config_updater/gu_common.py b/generic_config_updater/gu_common.py index 3b25ec292a1..9f538ace4a4 100644 --- a/generic_config_updater/gu_common.py +++ b/generic_config_updater/gu_common.py @@ -145,8 +145,13 @@ def validate_config_db_config(self, config_db_as_json): self.validate_lanes] try: - # Loading data automatically does full validation - sy.loadData(config_db_as_json) + # Loading data automatically does full validation. + # quiet=True suppresses sonic_yang.loadData's LOG_ERR + # "Data Loading Failed" line on every exception (log-and-throw + # antipattern). Real failures still surface via the returned + # tuple / SonicYangException, so callers retain full error + # signal -- only the duplicate syslog spam is silenced. + sy.loadData(config_db_as_json, quiet=True) for supplemental_yang_validator in supplemental_yang_validators: success, error = supplemental_yang_validator(config_db_as_json) if not success: diff --git a/tests/generic_config_updater/patch_sorter_test.py b/tests/generic_config_updater/patch_sorter_test.py index a092f26101a..c60b7b07532 100644 --- a/tests/generic_config_updater/patch_sorter_test.py +++ b/tests/generic_config_updater/patch_sorter_test.py @@ -946,6 +946,23 @@ def test_validate__valid_config_db_after_applying_move__success(self): self.assertTrue( validator.validate(JsonMoveGroup("", self.any_move), self.any_diff, self.any_simulated_config)[0]) + def test_validate__passes_quiet_true_to_config_wrapper(self): + # Regression guard: gu_common.ConfigWrapper.validate_config_db_config + # MUST call sonic_yang.loadData with quiet=True so the speculative + # patch-sort search does not spam syslog with transient YANG + # leafref LOG_ERR lines (the sorter already handles those via the + # returned tuple). This is enforced inside ConfigWrapper itself, + # so all callers benefit; FullConfigMoveValidator simply delegates. + config_wrapper = Mock() + config_wrapper.validate_config_db_config.return_value = (True, None) + validator = ps.FullConfigMoveValidator(config_wrapper) + + validator.validate(JsonMoveGroup("", self.any_move), self.any_diff, self.any_simulated_config) + + config_wrapper.validate_config_db_config.assert_called_once_with( + self.any_simulated_config) + + class TestCreateOnlyMoveValidator(unittest.TestCase): def setUp(self): self.validator = ps.CreateOnlyMoveValidator(ps.PathAddressing())