ls_update_certs.py fails in vCenter 8.0 U2 with "AttributeError: module 'base64' has no attribute 'decodestring'"
search cancel

ls_update_certs.py fails in vCenter 8.0 U2 with "AttributeError: module 'base64' has no attribute 'decodestring'"

book

Article ID: 344888

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Symptoms:
  • In VCenter 8.0 U2 and above, the ls_update_certs.py tool may report an AttributeError as follows:
Traceback (most recent call last):
  File "/usr/lib/vmware-lookupsvc/tools/ls_update_certs.py", line 15, in <module>
    lstoolutil.modify_svc_ep_certs(args.url,
  File "/usr/lib/vmware-lookupsvc/tools/lstoolutil.py", line 113, in modify_svc_ep_certs
    update55_ct = _modify_svc_eps(lsUrl, True, ids55, _update_svc_spec, username, password)
  File "/usr/lib/vmware-lookupsvc/tools/lstoolutil.py", line 139, in _modify_svc_eps
    svcUpdated = fnUpdateSvcSpec(io.StringIO(oldSpec), newSpec)
  File "/usr/lib/vmware-lookupsvc/tools/lstoolutil.py", line 110, in _update_svc_spec
    update_ct = _modify_ep_certs(oldSpec, newSpec, oldThumbprint, newCert)
  File "/usr/lib/vmware-lookupsvc/tools/lstoolutil.py", line 217, in _modify_ep_certs
    h.update(base64.decodestring(value.encode('utf-8')))
AttributeError: module 'base64' has no attribute 'decodestring'


Environment

VMware vCenter Server 8.0.2

Cause

vCenter Server 8.0 U2 and above use an API deprecated in Python 3.10.

Resolution

VMware is aware of this issue and will address it in a future release.

Workaround:
To workaround this issue, following these steps to repair the script:
  1. SSH to the vCenter Server as root. 
  2. At the bash prompt, enter the following:
cp /usr/lib/vmware-lookupsvc/tools/lstoolutil.py ~/lstoolutil.bak
sed -i 's/decodestring/decodebytes/g' /usr/lib/vmware-lookupsvc/tools/lstoolutil.py