Skip to content

Commit

Permalink
Merge pull request avocado-framework#5885 from sunqingwei811/master
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Richter <[email protected]>
  • Loading branch information
richtja authored Mar 25, 2024
2 parents 7af2ffc + 8cb7135 commit e2755cb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions avocado/utils/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,14 @@ def get_disks():
:returns: a list of paths to the physical disks on the system
:rtype: list of str
"""
json_result = process.run("lsblk --json --paths --inverse")
json_data = json.loads(json_result.stdout_text)
try:
json_result = process.run("lsblk --json --paths --inverse")
except process.CmdError as ce:
raise DiskError(f"Error occurred while executing lsblk command: {ce}")
try:
json_data = json.loads(json_result.stdout_text)
except json.JSONDecodeError as je:
raise DiskError(f"Error occurred while parsing JSON data: {je}")
disks = []
for device in json_data["blockdevices"]:
disks.append(device["name"])
Expand Down

0 comments on commit e2755cb

Please sign in to comment.