From 59702318e1089433368a69ed364f79583ee53bd1 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Tue, 12 Sep 2017 21:12:23 +0200 Subject: [PATCH] yum: fallback to epoch=0 if not available --- lib/ansible/modules/packaging/os/yum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index b2b5fb387e..b6359e7578 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -616,7 +616,7 @@ def local_envra(path): finally: os.close(fd) - return '%s:%s-%s-%s.%s' % (header[rpm.RPMTAG_EPOCH], + return '%s:%s-%s-%s.%s' % (header[rpm.RPMTAG_EPOCH] or '0', header[rpm.RPMTAG_NAME], header[rpm.RPMTAG_VERSION], header[rpm.RPMTAG_RELEASE], @@ -755,7 +755,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, i elif '://' in spec: # download package so that we can check if it's already installed package = fetch_rpm_from_url(spec, module=module) - envra = local_envra(module, package) + envra = local_envra(package) if is_installed(module, repoq, envra, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot): # if it's there, skip it continue