SHA256
1
0
forked from pool/salt
salt/fix-index-error-when-running-on-python-3.patch

38 lines
1.5 KiB
Diff

From 5502f05fac89330ab26d04e29d3aa6d36ab928c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Thu, 20 Sep 2018 11:51:58 +0100
Subject: [PATCH] Fix index error when running on Python 3
Fix wrong queryformat for zypper list_provides
---
salt/modules/zypper.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 695bce4f4e..e4423cf1fc 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -2314,7 +2314,7 @@ def list_provides(**kwargs):
'''
ret = __context__.get('pkg.list_provides')
if not ret:
- cmd = ['rpm', '-qa', '--queryformat', '[%{PROVIDES}_|-%{NAME}\n]']
+ cmd = ['rpm', '-qa', '--queryformat', '%{PROVIDES}_|-%{NAME}\n']
ret = dict()
for line in __salt__['cmd.run'](cmd, output_loglevel='trace', python_shell=False).splitlines():
provide, realname = line.split('_|-')
@@ -2379,7 +2379,7 @@ def resolve_capabilities(pkgs, refresh, **kwargs):
try:
result = search(name, provides=True, match='exact')
if len(result) == 1:
- name = result.keys()[0]
+ name = next(iter(result.keys()))
elif len(result) > 1:
log.warn("Found ambiguous match for capability '%s'.", pkg)
except CommandExecutionError as exc:
--
2.17.1