Fix for yum's use of rpm with non English locales
Depends upon https://github.com/ansible/ansible/pull/14025 Fixes https://github.com/ansible/ansible/issues/13996 Fixes https://github.com/ansible/ansible/issues/13975
This commit is contained in:
parent
35b131e71a
commit
d7fac82f97
1 changed files with 5 additions and 2 deletions
|
@ -256,7 +256,10 @@ def is_installed(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=None, di
|
|||
rpmbin = module.get_bin_path('rpm', required=True)
|
||||
|
||||
cmd = [rpmbin, '-q', '--qf', qf, pkgspec]
|
||||
rc, out, err = module.run_command(cmd)
|
||||
# rpm localizes messages and we're screen scraping so make sure we use
|
||||
# the C locale
|
||||
lang_env = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||
rc, out, err = module.run_command(cmd, environ_update=lang_env)
|
||||
if rc != 0 and 'is not installed' not in out:
|
||||
module.fail_json(msg='Error from rpm: %s: %s' % (cmd, err))
|
||||
if 'is not installed' in out:
|
||||
|
@ -265,7 +268,7 @@ def is_installed(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=None, di
|
|||
pkgs = [p for p in out.replace('(none)', '0').split('\n') if p.strip()]
|
||||
if not pkgs and not is_pkg:
|
||||
cmd = [rpmbin, '-q', '--qf', qf, '--whatprovides', pkgspec]
|
||||
rc2, out2, err2 = module.run_command(cmd)
|
||||
rc2, out2, err2 = module.run_command(cmd, environ_update=lang_env)
|
||||
else:
|
||||
rc2, out2, err2 = (0, '', '')
|
||||
|
||||
|
|
Loading…
Reference in a new issue