IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

zfs.py 428B

4 years ago
1234567891011121314151617181920
  1. import subprocess
  2. import csv
  3. import io
  4. def zfs_run(command):
  5. out = subprocess.check_output(command)
  6. return out
  7. def zfs_parse_output(command):
  8. out = zfs_run(command)
  9. s = io.StringIO(out.decode('utf-8'))
  10. r = csv.reader(s, delimiter='\t')
  11. return [a for a in r]
  12. def zfs_get_type(name):
  13. lst = zfs_parse_output(['zfs', 'list', '-o', 'name,type', '-H', name])
  14. return lst[0][1]