import sys
from univention.management.console.modules.quota.tools import repquota_parse

# get the repquota report:
# /usr/sbin/repquota -C -v $PARTITION > quotareport.txt
# call this script with the path to quotareport.txt
# wait for a traceback... the last printed line is a problem


def main():
    report_file = sys.argv[1]
    with open(report_file, 'r') as report:
        lines = report.readlines()
        for line in lines[5:]:
            try:
                repquota_parse('foo', [line.strip()])
            except ValueError:
                print('############Broken?###########')
                print(line.strip())


if __name__ == '__main__':
    main()
