AMBARI-22616 noplugins switch should not be used for yum repos backed by RedHat 
Satellite/Spacewalk (dgrinenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1ed7c086
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1ed7c086
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1ed7c086

Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 1ed7c086e4d417b47de8a2a7b80e28956cf01d47
Parents: 348bdd6
Author: Dmytro Grinenko <hapyles...@apache.org>
Authored: Fri Dec 8 16:30:46 2017 +0200
Committer: Dmytro Grinenko <hapyles...@apache.org>
Committed: Fri Dec 8 16:30:46 2017 +0200

----------------------------------------------------------------------
 .../core/providers/package/yumrpm.py                   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1ed7c086/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
 
b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
index c83a3ce..3742ff6 100644
--- 
a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
+++ 
b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
@@ -52,8 +52,8 @@ YUM_TR_PREFIX = "transaction-"
 
 YUM_REPO_LOCATION = "/etc/yum.repos.d"
 REPO_UPDATE_CMD = ['/usr/bin/yum', 'clean', 'metadata']
-ALL_INSTALLED_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "installed", 
"--noplugins"]
-ALL_AVAILABLE_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "available", 
"--noplugins"]
+ALL_INSTALLED_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "installed"]
+ALL_AVAILABLE_PACKAGES_CMD = [AMBARI_SUDO_BINARY, "yum", "list", "available"]
 VERIFY_DEPENDENCY_CMD = ['/usr/bin/yum', '-d', '0', '-e', '0', 'check', 
'dependencies']
 
 # base command output sample:
@@ -191,7 +191,14 @@ class YumProvider(RPMBasedPackageProvider):
       for line in lines[skip_index:]:
         items = items + line.strip(' \t\n\r').split()
 
-      for i in range(0, len(items), 3):
+      items_count = len(items)
+
+      for i in range(0, items_count, 3):
+
+        # check if we reach the end
+        if i+3 > items_count:
+          break
+
         if '.' in items[i]:
           items[i] = items[i][:items[i].rindex('.')]
         if items[i + 2].find('@') == 0:

Reply via email to