Encode parameters passed to pyghmi.ipmi.Command
Currently there is an issue in pyghmi which is if the userid or password passed to Command is string, the Command would not be initialized correctly and the program will stuck if someone uses the same parameters to create a Command object twice in a short time. This issue can be work around by passing the utf-8 encoded userid and password when creating a Command object. Change-Id: Id99e61da0a40d64ac3a766b9868580d4d580b9d7
This commit is contained in:
parent
138bf5df37
commit
08db0e8eed
|
@ -90,9 +90,10 @@ def get_tpm_status(d_info):
|
||||||
# 80 28 00 C0 C0: True
|
# 80 28 00 C0 C0: True
|
||||||
# 80 28 00 -- --: False (other values than 'C0 C0')
|
# 80 28 00 -- --: False (other values than 'C0 C0')
|
||||||
|
|
||||||
ipmicmd = ipmi_command.Command(bmc=d_info['irmc_address'],
|
ipmicmd = ipmi_command.Command(
|
||||||
userid=d_info['irmc_username'],
|
bmc=d_info['irmc_address'],
|
||||||
password=d_info['irmc_password'])
|
userid=d_info['irmc_username'].encode('utf-8'),
|
||||||
|
password=d_info['irmc_password'].encode('utf-8'))
|
||||||
try:
|
try:
|
||||||
response = _send_raw_command(ipmicmd, GET_TPM_STATUS)
|
response = _send_raw_command(ipmicmd, GET_TPM_STATUS)
|
||||||
if response['code'] != 0:
|
if response['code'] != 0:
|
||||||
|
@ -150,9 +151,10 @@ def get_pci_device(d_info, pci_device_ids):
|
||||||
# data1: 2 octet of VendorID
|
# data1: 2 octet of VendorID
|
||||||
# data2: 2 octet of DeviceID
|
# data2: 2 octet of DeviceID
|
||||||
|
|
||||||
ipmicmd = ipmi_command.Command(bmc=d_info['irmc_address'],
|
ipmicmd = ipmi_command.Command(
|
||||||
userid=d_info['irmc_username'],
|
bmc=d_info['irmc_address'],
|
||||||
password=d_info['irmc_password'])
|
userid=d_info['irmc_username'].encode('utf-8'),
|
||||||
|
password=d_info['irmc_password'].encode('utf-8'))
|
||||||
|
|
||||||
response = itertools.takewhile(
|
response = itertools.takewhile(
|
||||||
lambda y: (y[1]['code'] != 0xC9 and y[1].get('error') is None),
|
lambda y: (y[1]['code'] != 0xC9 and y[1].get('error') is None),
|
||||||
|
|
Loading…
Reference in New Issue