Skip to content

[th/setting-no-empty-str-props] validate string properties generically in NMSetting and reject empty strings

Thomas Haller requested to merge th/setting-no-empty-str-props into main

Currently, our validation is all done by verify(). We can do better.

For example, the vast majority of string properties are not supposed to accept empty values (because of the difficulty of distinguishing NULL and "" in nmcli and the general question what NULL vs. "" means). A notable exception is gsm.apn property. See also .handle_emptyunset attribute in nmcli.

Anyway. This is an example of a validation that should be done by default and without extra work. This branch adds a mechanism for such generic validations (_verify_properties()). It also adds direct_string_allow_empty to the property description.

Note that for now, direct_string_allow_empty is set to TRUE for all existing properties. We should review that, and set it to FALSE were suitable. But the main point is that new properties get the strong validation by default.

Merge request reports