I was stuck by very nasty error while installing latest
HDP 2.6.3 on RedHat 7.3. Installation failed giving the following error message:
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 170, in actionexecute
installed_packages, repos = self.execute_existing_repos_and_installed_packages_check(config)
File "/var/lib/ambari-agent/cache/custom_actions/scripts/check_host.py", line 233, in execute_existing_repos_and_installed_packages_check
installedPackages = self.pkg_provider.all_installed_packages()
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 222, in all_installed_packages
return self._get_installed_packages(None)
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 157, in _get_installed_packages
packages = self._lookup_packages([AMBARI_SUDO_BINARY, "yum", "list", "installed"], "Installed Packages")
File "/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py", line 191, in _lookup_packages
if items[i + 2].find('@') == 0:
IndexError: list index out of range
No handlers could be found for logger "ambari_agent.HostCheckReportFileHandler"
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/ambari_agent/HostCheckReportFileHandler.py", line 74, in writeHostChecksCustomActionsFile
items.append(itemDetail['name'])
TypeError: string indices must be integers, not str
I took me some time to get to the bottom. It looked that the culprit was additional stuff attached to the end of "yum list installed".
yum-metadata-parser.x86_64 1.1.4-10.el7 @anaconda/7.3
yum-rhn-plugin.noarch 2.0.1-6.1.el7_3 @rhel-7-server-rpms
zip.x86_64 3.0-11.el7 @anaconda/7.3
zlib.x86_64 1.2.7-17.el7 @anaconda/7.3
Uploading Enabled Repositories Report
Loaded plugins: product-id
Judging from the Python source code:
for i in range(0, len(items), 3):
if '.' in items[i]:
items[i] = items[i][:items[i].rindex('.')]
if items[i + 2].find('@') == 0:
items[i + 2] = items[i + 2][1:]
packages.append(items[i:i + 3])
return packages
the installer is expecting a number of elements returned from "yum list" to be divided by 3 and this two lines at the end obviously break this assumption. So the solution (working) was the manual fix in
/usr/lib/ambari-agent/lib/resource_management/core/providers/package/yumrpm.py. Important: in this file, not in the file specified in error stack trace:
/usr/lib/python2.6/site-packages/resource_management/core/providers/package/yumrpm.py, because the installer every time overwrites script in
/usr/lib/python2.6/site-packages/resource_management/core/providers/package directory. After the fix the aforementioned piece of code looks:
for i in range(0, len(items), 3):
if i + 2 >= len(items) : break
if '.' in items[i]:
items[i] = items[i][:items[i].rindex('.')]
if items[i + 2].find('@') == 0:
items[i + 2] = items[i + 2][1:]
packages.append(items[i:i + 3])
return packages
Brak komentarzy:
Prześlij komentarz