[BUG] ipmi.get_health: NameError: name 'unicode' is not defined
Open
Nobody has claimed this yet.
bug
dependency
python3
Upstream-Bug
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
The get_health method of the ipmi module throws NameError: name 'unicode' is not defined when querying my SuperMicro IPMI.
[root@salt ~]# salt 'uslogsdnas01.--redacted--.local' ipmi.get_health api_host=--redacted-ip-- api_user='admin' api_pass='--redacted-password--'
uslogsdnas01.--redacted--.local:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/minion.py", line 1905, in _thread_return
function_name, function_args, executors, opts, data
File "/usr/lib/python3/dist-packages/salt/minion.py", line 1861, in _execute_job_function
return_data = self.executors[fname](opts, data, func, args, kwargs)
File "/usr/lib/python3/dist-packages/salt/loader.py", line 1241, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader.py", line 2274, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader.py", line 2289, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader.py", line 1241, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader.py", line 2274, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader.py", line 2289, in _run_as
return _func_or_method(*args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/modules/ipmi.py", line 611, in get_health
return s.get_health()
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/command.py", line 660, in get_health
for reading in self.get_sensor_data():
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/command.py", line 858, in get_sensor_data
self._sdr = sdr.SDR(self)
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/sdr.py", line 610, in __init__
self.read_info()
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/sdr.py", line 641, in read_info
self.get_sdr()
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/sdr.py", line 715, in get_sdr
self.add_sdr(sdrdata)
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/sdr.py", line 734, in add_sdr
newent = SDREntry(sdrbytes, self.ipmicmd)
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/sdr.py", line 276, in __init__
self.fru_decode(entrybytes[5:])
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/sdr.py", line 310, in fru_decode
self.fru_name = self.tlv_decode(entry[10], entry[11:])
File "/usr/lib/python3/dist-packages/pyghmi/ipmi/sdr.py", line 575, in tlv_decode
return unicode(struct.pack("%dB" % len(data), *data), "utf_8")
NameError: name 'unicode' is not defined
Versions Report
Minion:
Salt Version:
Salt: 3003.2
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10
libgit2: Not Installed
M2Crypto: 0.31.0
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.7.3 (default, Jan 22 2021, 20:04:44)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 17.1.2
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist: debian 10 buster
locale: UTF-8
machine: x86_64
release: 5.4.128-1-pve
system: Linux
version: Debian GNU/Linux 10 buster
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with salt/modules/ipmi.py at get_health, then follow the traceback into pyghmi/ipmi/sdr.py and its tlv_decode path. Reproduce the SuperMicro get_health call or inspect the reported Python 3 failure. Done means the IPMI health query completes without the reported NameError for the affected response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100