saltstack/salt — pull request #2837 by archtaku (2012-12-08 05:31:32+00:00)
Title: More multiple-version support for pkg.list_pkgs()

I did zypper and both yumpkg modules. I have a few important notes to make, though:

1) I changed the yum modules to parse rpm instead of yum. This provides a considerable performance boost because the yum overhead is not needed when all you want is to list the installed packages. I saw my test VM go from ~10 secs to run list_pkgs to 1 sec.

2) (IMPORTANT) The yumpkg modules have been changed so that the package architecture is displayed in the version string. This is important because RedHat-based systems like Fedora, CentOS, and RHEL don't name the x86_64 and i686 versions of a package differently, they'll just be the same name but with different architectures. Note that this change was not needed for zypper (another RPM-based provider) since Suse puts "-32bit" in the 32-bit versions of packages that get installed on x86_64 hosts.

3) Due to #2 above, we may want to think of a way to make salt use the minion's "cpuarch" grain to manually specify the arch to install when no arch is provided, to keep backwards compatibility in states. I'll bring this up on the mailing list for further discussion.

4) The previous version of yumpkg.py's list_pkgs function can be found here: https://gist.github.com/4238643