@ -512,19 +512,6 @@ def local_nvra(module, path):
header [ rpm . RPMTAG_RELEASE ] ,
header [ rpm . RPMTAG_RELEASE ] ,
header [ rpm . RPMTAG_ARCH ] )
header [ rpm . RPMTAG_ARCH ] )
def local_name ( module , path ) :
""" return package name of a local rpm passed in """
ts = rpm . TransactionSet ( )
ts . setVSFlags ( rpm . _RPMVSF_NOSIGNATURES )
fd = os . open ( path , os . O_RDONLY )
try :
header = ts . hdrFromFdno ( fd )
finally :
os . close ( fd )
return header [ rpm . RPMTAG_NAME ]
def pkg_to_dict ( pkgstr ) :
def pkg_to_dict ( pkgstr ) :
if pkgstr . strip ( ) :
if pkgstr . strip ( ) :
@ -599,10 +586,10 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
res [ ' msg ' ] + = " No Package file matching ' %s ' found on system " % spec
res [ ' msg ' ] + = " No Package file matching ' %s ' found on system " % spec
module . fail_json ( * * res )
module . fail_json ( * * res )
pkg_ name = local_n ame ( module , spec )
nvr a = local_n vr a( module , spec )
# look for them in the rpmdb
# look for them in the rpmdb
if is_installed ( module , repoq , pkg_ name , conf_file , en_repos = en_repos , dis_repos = dis_repos ) :
if is_installed ( module , repoq , nvr a, conf_file , en_repos = en_repos , dis_repos = dis_repos ) :
# if they are there, skip it
# if they are there, skip it
continue
continue
pkg = spec
pkg = spec
@ -611,8 +598,8 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
elif ' :// ' in spec :
elif ' :// ' in spec :
# download package so that we can check if it's already installed
# download package so that we can check if it's already installed
package = fetch_rpm_from_url ( spec , module = module )
package = fetch_rpm_from_url ( spec , module = module )
pkg_ name = local_n ame ( module , package )
nvr a = local_n vr a( module , package )
if is_installed ( module , repoq , pkg_ name , conf_file , en_repos = en_repos , dis_repos = dis_repos ) :
if is_installed ( module , repoq , nvr a, conf_file , en_repos = en_repos , dis_repos = dis_repos ) :
# if it's there, skip it
# if it's there, skip it
continue
continue
pkg = package
pkg = package