#!/usr/bin/python3

# bigboot_size: "{{ bigboot_size_expansion_mb[:-2] | int | get_block_size_up }}"

class FilterModule (object):
  def filters (self):
    return {
      'bigboot_fallback_size': self.bigboot_fallback_size,
      'moo': self.moo,
    }

  def bigboot_fallback_size(self, fallback_size):
    return ('{}{}'.format(fallback_size, 'M'))

  def moo(self, a_variable):
    a_new_variable = (str(a_variable) + '~~~~MOOOOOOOOOOOOOOOOOOOOOOOOO! => ' + '%s' % type(a_variable))
    return a_new_variable



# import shutil
# import os

# def check_mount_space(mount_path, min_space_gb=1):
#     try:
#         # Get disk usage statistics for the mount point
#         disk_usage = shutil.disk_usage(mount_path)

#         # Convert bytes to gigabytes
#         free_space_gb = disk_usage.free / (1024 ** 3)

#         print(f"Mount point: {mount_path}")
#         print(f"Free space: {free_space_gb:.2f} GB")

#         if free_space_gb > min_space_gb:
#             print("✓ More than 1GB available")
#             return True
#         else:
#             print("✗ Less than 1GB available")
#             return False

#     except Exception as e:
#         print(f"Error checking {mount_path}: {str(e)}")
#         return False

# def check_all_mounts():
#     # Read mount points from /proc/mounts
#     with open('/proc/mounts', 'r') as f:
#         mounts = f.readlines()

#     results = []
#     for mount in mounts:
#         # Split the mount line and get the mount point (second field)
#         mount_point = mount.split()[1]

#         # Skip some virtual filesystems
#         if mount_point.startswith(('/proc', '/sys', '/dev', '/run')):
#             continue

#         results.append(check_mount_space(mount_point))

#     return results

# if __name__ == "__main__":
#     print("Checking mount points for available space...")
#     check_all_mounts()
