Fix bmc_password encoding when obtained from the subcloud

Currently if the simplex subcloud is configured to store bmc info
in its barbican database (i.e., system host-update bmc_ip=...),
orchestrated upgrade will fail due to a TypeError exception. This
issue is the result of a missing upgrade test case in the
verification plan of story 2010119 (CentOS->Debian transition).

Test Plan:
  - Verify successful AIOSX subcloud upgrade with configured bmc info
  - Verify successful AIOSX subcloud upgrade without configured bmc info
  - Verify successful AIODX subcloud upgrade

Closes-Bug: 2023081
Signed-off-by: Tee Ngo <tee.ngo@windriver.com>
Change-Id: I8630a229e6a7fc1c60ff4268f84736de1c3ccdab
This commit is contained in:
Tee Ngo 2023-06-06 14:23:33 -04:00
parent d273ef37de
commit fe1f26719c

View File

@ -7,7 +7,8 @@ import json
import keyring
import os
from base64 import b64encode
from oslo_serialization import base64
from dccommon.consts import AVAILABILITY_OFFLINE
from dccommon.install_consts import ANSIBLE_SUBCLOUD_INSTALL_PLAYBOOK
from dccommon.subcloud_install import SubcloudInstall
@ -297,7 +298,7 @@ class UpgradingSimplexState(BaseState):
# If the host is configured to store bmc in its barbican database,
# encode the password. Otherwise leave it as None and it will be
# replaced with the value retrieved from the dcmanager database.
bmc_password = b64encode(bmc_password)
bmc_password = base64.encode_as_text(bmc_password)
volatile_data_install.update({
'bmc_address': host.bm_ip,