Skip to content

Commit 0d71357

Browse files
committed
Resolve CR comments
1 parent 6811263 commit 0d71357

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

sonic_platform_base/bmc_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ def get_version(self):
327327
Returns 'N/A' if the BMC firmware version cannot be retrieved
328328
"""
329329
ret = 0
330-
version = 'N/A'
331330
try:
332331
ret, version = self._get_firmware_version(self._get_firmware_id())
333332
if ret != RedfishClient.ERR_CODE_OK:

sonic_platform_base/chassis_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,7 @@ def get_bmc(self):
795795
Get bmc device on this chassis
796796
797797
Returns:
798-
An object derived from BMCBase representing the hardware
799-
eeprom device
798+
An object derived from BMCBase representing the BMC device
800799
"""
801800
return self._bmc
802801

sonic_platform_base/redfish_client.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class RedfishClient:
7575
Constructor
7676
Callbacks are provided because:
7777
1. Each BMC instance may have its own BMC users management mechanism.
78-
1. Password is not allowed to be saved for security concern.
79-
2. If token expires or becomes invalid for some reason (for example, being revoked from BMC web interface),
78+
2. Password is not allowed to be saved for security concern.
79+
3. If token expires or becomes invalid for some reason (for example, being revoked from BMC web interface),
8080
RedfishClient will do login retry in which password is required anyway. It will get password from an external password provider,
8181
for example class BMC which holds the responsibility of generating password from TPM.
8282
@@ -127,7 +127,7 @@ def __build_logout_cmd(self):
127127
return cmd
128128

129129
'''
130-
Build the POST command to do firmware upgdate-multipart
130+
Build the POST command to do firmware update-multipart
131131
132132
Args:
133133
fw_image: A string, path to the firmware image file
@@ -328,7 +328,7 @@ def __obfuscate_auth_token(self, cmd):
328328
return obfuscation_cmd
329329

330330
'''
331-
Obfuscate password while aksing for password change
331+
Obfuscate password while asking for password change
332332
333333
Args:
334334
cmd: A string, the cURL command to be obfuscated
@@ -424,7 +424,7 @@ def __get_headers_and_body_from_curl_output(self, curl_output):
424424
Returns:
425425
An integer, RedfishClient error code
426426
'''
427-
def __curl_errors_to_redfish_erros_translation(self, curl_error):
427+
def __curl_errors_to_redfish_errors_translation(self, curl_error):
428428
return self.CURL_TO_REDFISH_ERROR_MAP.get(
429429
curl_error, RedfishClient.ERR_CODE_CURL_FAILURE)
430430

@@ -506,7 +506,7 @@ def __exec_curl_cmd_internal(self, cmd):
506506
else:
507507
logger.log_notice(f'cURL error:')
508508
self.log_multi_line_str(error_str)
509-
ret = self.__curl_errors_to_redfish_erros_translation(ret)
509+
ret = self.__curl_errors_to_redfish_errors_translation(ret)
510510

511511
return (ret, http_status_code, output_str, error_str)
512512

@@ -967,7 +967,6 @@ def login(self):
967967
except Exception as e:
968968
logger.log_error(f'Login failure: Exception during parsing body: {str(e)}')
969969
self.log_multi_line_str(response)
970-
pass
971970

972971
# Extract both token and session ID from headers
973972
token = headers.get('X-Auth-Token')
@@ -1223,7 +1222,7 @@ def redfish_api_trigger_bmc_debug_log_dump(self):
12231222
Get BMC debug log dump file
12241223
12251224
Args:
1226-
task_id: A string, the task ID returned from redfish_api_trigger_bmc_debug
1225+
task_id: A string, the task ID returned from redfish_api_trigger_bmc_debug_log_dump
12271226
filename: A string, the output file name
12281227
file_path: A string, the output file path
12291228
timeout: An integer, overall timeout in seconds
@@ -1357,9 +1356,6 @@ def redfish_api_get_eeprom_info(self, component_name):
13571356
def redfish_api_change_login_password(self, new_password, user=None):
13581357
logger.log_notice('Changing BMC password\n')
13591358
cmd = self.__build_change_password_cmd(new_password, user)
1360-
ret = RedfishClient.ERR_CODE_OK
1361-
response = ''
1362-
error = ''
13631359
ret, _, response, error = self.exec_curl_cmd(cmd)
13641360

13651361
if (ret != RedfishClient.ERR_CODE_OK):
@@ -1387,7 +1383,7 @@ def redfish_api_change_login_password(self, new_password, user=None):
13871383
if '@Message.ExtendedInfo' in json_response:
13881384
for info in json_response['@Message.ExtendedInfo']:
13891385
if info['MessageId'].endswith('Success'):
1390-
logger.log_notice('Password changed sucessfully')
1386+
logger.log_notice('Password changed successfully')
13911387
return (RedfishClient.ERR_CODE_OK, '')
13921388

13931389
msg = 'Error: Unexpected response format'

tests/redfish_client_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def password_callback(self):
5151
return TestRedfishClient.BMC_NOS_ACCOUNT_DEFAULT_PASSWORD
5252

5353
@mock.patch('subprocess.Popen')
54-
def test_login_sucess(self, mock_popen):
54+
def test_login_success(self, mock_popen):
5555
"""Test successful login"""
5656
side_effects = []
5757
for fname in ['mock_bmc_login_token_response', \

0 commit comments

Comments
 (0)