aliyuncli-ra configure fails with "NameError: name 'reload' is not defined"

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL) 8 with the High Availability Add-on
  • Alibaba Cloud (Aliyun)
  • resource-agents-aliyun

Issue

  • aliyuncli-ra configure fails with "NameError: name 'reload' is not defined".
# aliyuncli-ra configure
Traceback (most recent call last):
  File "/usr/bin/aliyuncli-ra", line 12, in <module>
    load_entry_point('aliyuncli==2.1.10', 'console_scripts', 'aliyuncli')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 476, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2700, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2318, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/resource-agents/bundled/aliyun/aliyuncli/aliyuncli.py", line 22, in <module>
    reload(sys)
NameError: name 'reload' is not defined

Resolution

Upgrade to resource-agents-4.1.1-33.el8 or later.

Root Cause

The bundled libraries in the resource-agents-aliyun package are written for Python2. Module names and module search paths have changed in Python3. RHEL 8 only ships Python3, so the aliyuncli-ra tool fails due to missing modules and functions.

SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.