If a valueLess node is added or removed from the CLI, a call to leaf_node_changed() will not detect it.
Reason is:
def leaf_node_changed(conf, path): """ Check if a leaf node was altered. If it has been altered - values has been changed, or it was added/removed, we will return a list containing the old value(s). If nothing has been changed, None is returned. NOTE: path must use the real CLI node name (e.g. with a hyphen!) """ from vyos.configdiff import get_config_diff D = get_config_diff(conf, key_mangling=('-', '_')) D.set_level(conf.get_level()) (new, old) = D.get_value_diff(path) # if node is valueLess, on change old or new (depending on addition or deletion) will be {} and is treated as None if new != old: if old is None: return [] if isinstance(old, str): return [old] if isinstance(old, list): if isinstance(new, str): new = [new] elif isinstance(new, type(None)): new = [] return list_diff(old, new) return None
Not a blocker for 1.3 as this functionality is not (yet) used. Nevertheless this functionality is required for T4264