Move epoch removal

The previous commit causes a failure when a package does not have a
version specified. Caught by integration tests, yay!
This commit is contained in:
Erik Johnson 2016-03-03 15:39:12 -06:00
parent 290192af56
commit 4fa7e4defe

View file

@ -1226,12 +1226,6 @@ def install(name=None,
for pkg_item_list in pkg_params_items:
if pkg_type == 'repository':
pkgname, version_num = pkg_item_list
if _yum() == 'yum':
# yum install does not support epoch without the arch, and we
# won't know what the arch will be when it's not provided. It
# could either be the OS architecture, or 'noarch', and we
# don't make that distinction in the pkg.list_pkgs return data.
version_num = version_num.split(':', 1)[-1]
else:
try:
pkgname, pkgpath, version_num = pkg_item_list
@ -1254,6 +1248,13 @@ def install(name=None,
# not None, since the only way version_num is not None is if RPM
# metadata parsing was successful.
if pkg_type == 'repository':
if _yum() == 'yum':
# yum install does not support epoch without the arch, and
# we won't know what the arch will be when it's not
# provided. It could either be the OS architecture, or
# 'noarch', and we don't make that distinction in the
# pkg.list_pkgs return data.
version_num = version_num.split(':', 1)[-1]
arch = ''
try:
namepart, archpart = pkgname.rsplit('.', 1)