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.

15 lines
326B

  1. import random
  2. from .zfs import zfs_exists
  3. def random_sha256_hexdigest():
  4. return bytes([ random.randint(0, 255) for _ in range(32) ]).hex()
  5. def find_prefix(head, tail):
  6. for pre in range(7, len(tail)):
  7. name = head + tail[:pre]
  8. if not zfs_exists(name):
  9. break
  10. return name