Closed bmr-cymru closed 2 years ago
Reviewing this, there are currently 10 plugins that use wildcards in their enablement triggers for packages - drbd, java, mysql, nss, openssl, openvswitch, ovn_central, ovn_host, pam, and perl.
Some of these are old, and some are relatively newer. So, we have a couple options here:
pkg_by_name()
to accept wildcardsis_installed()
to directly leverage all_pkgs_by_name()
and have pkg_by_name()
only do exact matches. There are uses of pkg_by_name()
outside plugin enablement, such as cluster profiles and presets loading/enablement that today do not have any wildcards in usepkg_by_name()
to be an exact match, and update these plugins to not use wildcards in their package triggers.I'm personally leaning towards option 2. While not a very common use case, allowing wildcards in packages tuples for plugins is handy when the package has version information baked into the name (for some forsaken reason), e.g. - openvswitch with packages = ('openvswitch', 'openvswitch2.*', [...]
+1 for the option 2. Plugin enablement by package*
makes sense from a user perspective, while we should prevent the confusion that Bryn wrote.
It was noticed while reviewing #1816 that the
PackageManager.pkg_by_name()
method applies shell-style wildcards to the package names it returns by applyingfnmatch.filter()
to the results ofall_pkgs_by_name()
. This can lead to confusing results when several packages exist which match a supplied pattern, since the function arbitrarily returns the last entry of the list of matching packages:Review this behaviour to see if anything relies on it currently and consider making the
pkg_by_name()
method an exact match.