Make a better effort to describe an alias reference. Fixes #13539
Each of deleteAlias(), openvpnAlias(), and staticrouteAlias() are called when deleting or modifying an alias to indicate that it is referenced by some other configuration item, which in turn call find_alias_reference() which returns descriptions of configuration references that can be displayed in warnings and errors.
find_alias_reference() is refactored into find_alias_reference_by_path() which accepts configlib paths instead of arrays, and makes a stronger attempt at picking a descriptive text for the item, enclosed in single quotes, cascading through descr, description, name. If none of these attributes exist, an ID description is chosen as a last resort.
For compatibility, find_alias_reference() is retained as a wrapper around find_alias_reference_by_path().
Each of deleteAlias(), openvpnAlias(), and staticrouteAlias() are refactored to adapt to the path interface and for better readability, calling find_alias_reference_by_path() in a loop over an associative array of section paths indexing arrays of field paths (where more than onesection/field pair is used).
Related issues
Bug #13539: Missing descriptions for referrers to firewall aliases cause empty strings for references to be returned when deleting an in-use alias
Make a better effort to describe an alias reference. Fixes #13539
Each of deleteAlias(), openvpnAlias(), and staticrouteAlias() are called when
deleting or modifying an alias to indicate that it is referenced by some other
configuration item, which in turn call find_alias_reference() which returns
descriptions of configuration references that can be displayed in warnings and
errors.
find_alias_reference() is refactored into find_alias_reference_by_path() which
accepts configlib paths instead of arrays, and makes a stronger attempt at
picking a descriptive text for the item, enclosed in single quotes, cascading
through descr, description, name. If none of these attributes exist, an ID
description is chosen as a last resort.
For compatibility, find_alias_reference() is retained as a wrapper around
find_alias_reference_by_path().
Each of deleteAlias(), openvpnAlias(), and staticrouteAlias() are refactored to
adapt to the path interface and for better readability, calling
find_alias_reference_by_path() in a loop over an associative array of section
paths indexing arrays of field paths (where more than onesection/field pair is
used).