Update aborted with Error: module 'cmk.rulesets.v1.form_specs.validators' has no attribute 'HostAddress'

I am trying to update my dev site from 2.4.0p10 to 2.4.0p12 and this happens:

| Traceback (most recent call last):
-|   File "/omd/sites/dev24/lib/python3/cmk/update_config/main.py", line 104, in main_check_config
-|     check_config(logger, conflict)
-|   File "/omd/sites/dev24/lib/python3/cmk/update_config/main.py", line 244, in check_config
-|     pre_action(logger, conflict_mode)
-|   File "/omd/sites/dev24/lib/python3/cmk/update_config/plugins/pre_actions/rulesets.py", line 50, in __call__
-|     result = _validate_rule_values(
-|              ^^^^^^^^^^^^^^^^^^^^^^
-|   File "/omd/sites/dev24/lib/python3/cmk/update_config/plugins/pre_actions/rulesets.py", line 134, in _validate_rule_values
-|     transformed_value = ruleset.rulespec.valuespec.transform_value(rule.value)
-|                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
-|   File "/omd/sites/dev24/lib/python3/cmk/gui/watolib/rulespecs.py", line 408, in valuespec
-|     return self._valuespec()
-|            ^^^^^^^^^^^^^^^^^
-|   File "/omd/sites/dev24/lib/python3/cmk/gui/utils/rule_specs/legacy_converter.py", line 431, in _transform_agent_config_rule_spec_match_type
-|     legacy_vs = convert_to_legacy_valuespec(parameter_form, localizer)
-|                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-|   File "/omd/sites/dev24/lib/python3/cmk/gui/utils/rule_specs/legacy_converter.py", line 846, in convert_to_legacy_valuespec
-|     to_convert = to_convert()
-|                  ^^^^^^^^^^^^
-|   File "/omd/sites/dev24/lib/python3/cmk/gui/utils/rule_specs/legacy_converter.py", line 81, in __call__
-|     return self.spec()
-|            ^^^^^^^^^^^
-|   File "/omd/sites/dev24/local/lib/python3/cmk_addons/plugins/slapd/rulesets/slapd_cee.py", line 84, in _valuespec_agent_config_slapd
-|     )),
-|         
-| AttributeError: module 'cmk.rulesets.v1.form_specs.validators' has no attribute 'HostAddress'
-| 
-| Update aborted with Error: module 'cmk.rulesets.v1.form_specs.validators' has no attribute 'HostAddress'.
-| Your site has not been modified.
-| The update can be retried after the error has been fixed.

Why is a validator removed between two patch releases, @moritz?

“Schöne” Beschreibung des Problems hier

What a mess…

How can you remove something from a public API within a patch release, @martin.hirschvogel?

So now we need to re-implement this functionality ourselves?

I’m sorry, Robert. As the work attempted to convey, this was an unfortunate situation that we would have liked to avoid.

The HostAddress helper was accidentally added to the v1 namespace during the development of version 2.4. Since we lacked the appropriate mechanisms, we only noticed this a few weeks ago.

Now that we were made aware of this, we had the following options

  1. Fix the bug as quickly as possible to prevent further spread (with the risk that the few users who discovered this helper would encounter problems) or
  2. Keep it for the time being, risk further use, perhaps mark it as “do not use” in some way to control the risk, and finally remove it with the next major version.

Of course, neither option is ideal. In this case, we opted for a). To my understanding the colleagues searched the exchange to get an understanding how widely spread the use is already and did not find anything. I suspect that our colleagues already had you and 1-2 other users in mind when they wrote the werk, in the hope that they could address any pain this might cause :wink: .

However, I understand that this is unsatisfactory and causes unnecessary friction. Certainly, approach b) would have been the compatible and correct approach for such a case.

I think we need to learn from this and

  1. Improve our technical mechanisms that detect such accidental changes.
  2. Temporarily accept such problems in the APIs as “unintended features” and treat changes to them in exactly the same way as other changes.

And to finally answer your last question: Yes, for the time being, please implement it for yourself.

Hi Lars,

but why remove it at all? I think this is really helpful.

I have “discovered” it because it was part of the official documentation.

This is mess, indeed. :sob:
The documentation is auto created, so it was added to the documentation as well when it was added to the module.
This really should not have happened. But note that “just keeping it” also would not have been a solution. By adding a feature to the API, we introduced the possibility to create an MKP that would work on 2.4, but not on 2.3. This should not be possible.
As soon as the feature was added, we created the possibility to create such a broken MKP – and there was no way of gracefully recovering from this f*** up.
What we have achieved by removing it is that from 2.4.0p12 onwards we’re back where we should have been all along: You cannot create an MKP that will not work with all versions above 2.3.0.
But I can see how this is annoying to you, since you found this meanwhile.

Sidenote: I would discourage my colleagues from using this validator by the way. When we introduce it, we usually get a ticket soon, complaining that “$HOSTNAME$” is no longer accepted as input, but YMMV…

1 Like