Workaround bug in yum python API

This works around a bug in the yum python API where removal of packages
that are required by other packages results in the removal of those
packages as well, and does not raise an exception when errors are
encountered during the transaction test, causing all packages to be
removed.

This commit manually performs the transaction test, and raises an
exception if any errors are found. It also adds a try/except to the
pkg.removed and pkg.purged states which catches the exception and
gracefully returns False without a traceback.

See https://github.com/saltstack/salt/issues/8201 for more information.

Fixes #8201.