saltstack/salt — pull request #7117 by terminalmage (2013-09-08 02:20:46+00:00)
Title: yumpkg[,5}: add pkg suggestions for nonexistant packages

We've already been doing something like this for ebuild.py for a while, but it was in pkg_resource.py. This pull request does the following:

1) Pulls the pkg target verification from pkg_resource.py into a function called ``check_db`` in ebuild.py, and changes the format of the output generated by this check (see the docstring for more information).
2) Modifies the ``pkg.installed`` state to use the return data generated by ``pkg.check_db`` and, if problems were encountered, to fail out of the state and notify the user of the suggested package names discovered by ``pkg.check_db``. **NOTE: If ``pkg.check_db`` does not exist, then the pkg.installed state will not attempt to run this function, and will thus proceed without the possiblity of failing out on this step.
3) Adds ``check_db`` functions to both yumpkg and yumpkg5, thereby adding the package suggestion capability to these providers.

This new framework for checking package targets before attempting an installation can now be easily extended to other providers. It is my hope that we can also use this to deprecate (and eventually drop) support of virtual packages in Ubuntu.