Skip to content

Commit

Permalink
Merge pull request avocado-framework-tests#1493 from Naresh-ibm/disk_…
Browse files Browse the repository at this point in the history
…info-py3

Disk_info.py, converting to python3
  • Loading branch information
narasimhan-v authored Dec 9, 2019
2 parents f12704e + 5f5656b commit 5823f2b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions io/disk/disk_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,21 @@ def test(self):
self.part_obj.unmount()
cmd = 'lshw -c disk | grep -n "%s" | cut -d ":" -f 1' % self.disk
middle = process.system_output(cmd, ignore_status=True,
shell=True, sudo=True)
shell=True, sudo=True).decode('utf-8')
if middle:
cmd = r'lshw -c disk | grep -n "\-disk" | cut -d ":" -f 1'
total = process.system_output(cmd, ignore_status=True,
shell=True, sudo=True)
shell=True,
sudo=True).decode('utf-8')
lst = total.splitlines() + middle.splitlines()
lst.sort()
index = lst.index(middle.splitlines()[0])
low = lst[index-1]
high = lst[index+1]
cmd = "lshw -c disk |sed -n '%s, %sp'" % (low, high)
disk_details = process.system_output(cmd, ignore_status=True,
shell=True, sudo=True)
shell=True,
sudo=True).decode('utf-8')
ls_string = "logicalsectorsize=%s sectorsize=%s" % (lbs, pbs)
if ls_string not in disk_details:
msg.append("Mismatch in sector sizes of lbs,pbs"
Expand Down

0 comments on commit 5823f2b

Please sign in to comment.