Merge "Encode parameters passed to pyghmi.ipmi.Command"

This commit is contained in:
Zuul 2022-07-15 05:55:36 +00:00 committed by Gerrit Code Review
commit 5624f8a68c
1 changed files with 8 additions and 6 deletions

View File

@ -90,9 +90,10 @@ def get_tpm_status(d_info):
# 80 28 00 C0 C0: True
# 80 28 00 -- --: False (other values than 'C0 C0')
ipmicmd = ipmi_command.Command(bmc=d_info['irmc_address'],
userid=d_info['irmc_username'],
password=d_info['irmc_password'])
ipmicmd = ipmi_command.Command(
bmc=d_info['irmc_address'],
userid=d_info['irmc_username'].encode('utf-8'),
password=d_info['irmc_password'].encode('utf-8'))
try:
response = _send_raw_command(ipmicmd, GET_TPM_STATUS)
if response['code'] != 0:
@ -150,9 +151,10 @@ def get_pci_device(d_info, pci_device_ids):
# data1: 2 octet of VendorID
# data2: 2 octet of DeviceID
ipmicmd = ipmi_command.Command(bmc=d_info['irmc_address'],
userid=d_info['irmc_username'],
password=d_info['irmc_password'])
ipmicmd = ipmi_command.Command(
bmc=d_info['irmc_address'],
userid=d_info['irmc_username'].encode('utf-8'),
password=d_info['irmc_password'].encode('utf-8'))
response = itertools.takewhile(
lambda y: (y[1]['code'] != 0xC9 and y[1].get('error') is None),