Advertisement
Guest User

Untitled

a guest
Jul 30th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. re_line2 = re.compile(
  2. r"\s+Vendor: (?P<vendor>\S+)\s+Model: (?P<model>.+) " +
  3. r"Rev: (?P<disk_revision>.+)")
  4. re_line3 = re.compile(
  5. r"\s+Type:\s+(?P<type>.*)\s+SCSI revision: (?P<scsi_revision>.+)")
  6.  
  7. [...]
  8.  
  9. m = re_line2.match(line)
  10. if m is not None:
  11. data[index]["vendor"] = m.group("vendor"),
  12. data[index]["model"] = m.group("model"),
  13. data[index]["revision-disk"] = m.group("disk_revision"),
  14. continue
  15.  
  16. m = re_line3.match(line)
  17. if m is not None:
  18. data[index]["type"] = m.group("type")
  19. data[index]["revision-scsi"] = m.group("scsi_revision")
  20. continue
  21.  
  22.  
  23. :
  24.  
  25. {
  26. "channel": "00",
  27. "host": "scsi6",
  28. "id": "00",
  29. "lun": "00",
  30. "model": [
  31. "ATP eUSB "
  32. ],
  33. "revision-disk": [
  34. "1100"
  35. ],
  36. "revision-scsi": "00",
  37. "type": "Direct-Access ANSI ",
  38. "vendor": [
  39. "ATP"
  40. ]
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement