Skip to content

Commit

Permalink
change name from list_images to list_image.
Browse files Browse the repository at this point in the history
  • Loading branch information
hdwhdw committed Jan 21, 2025
1 parent c8104f5 commit 01d7eca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions host_modules/image_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def checksum(self, file_path, algorithm):
@host_service.method(
host_service.bus_name(MOD_NAME), in_signature="", out_signature="is"
)
def list_images(self):
def list_image(self):
"""
List the current, next, and available SONiC images.
Expand All @@ -156,8 +156,9 @@ def list_images(self):
logger.info("List result: {}".format(result))
return 0, json.dumps(result)
except subprocess.CalledProcessError as e:
logger.error("Failed to list images: {} with return code {}".format(e.output.decode(), e.returncode))
return e.returncode, json.dumps({"error": "Failed to list images: {}".format(e.output.decode())})
msg = "Failed to list images: command {} failed with return code {} and message {}".format(e.cmd, e.returncode, e.output.decode())
logger.error(msg)
return e.returncode, msg

def _parse_sonic_installer_list(self, output):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/host_modules/image_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def test_list_image_success(self, mock_check_output, MockInit, MockBusName, Mock
mock_check_output.return_value = mock_output.encode()

# Act
rc, images_json = image_service.list_images()
rc, images_json = image_service.list_image()
images = json.loads(images_json)

# Assert
Expand Down

0 comments on commit 01d7eca

Please sign in to comment.