diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index 66508cb952e..94b4daea67c 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -610,7 +610,7 @@ def local_envra(module, 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], @@ -748,7 +748,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