def do_local_audit(self):
        open_files = clouseau.retention.utils.fileutils.get_open_files()

        all_files = {}
        files = self.find_all_files()

        magic = clouseau.retention.utils.magic.magic_open(clouseau.retention.utils.magic.MAGIC_NONE)
        magic.load()
        today = time.time()
        for (fname, fstat) in files:
            all_files[fname] = FileInfo(fname, magic, fstat)
            all_files[fname].load_file_info()
            all_files[fname].load_extra_file_info(today,
                                                  clouseau.retention.utils.config.conf['cutoff'],
                                                  open_files)

        all_files_sorted = sorted(all_files, key=lambda f: all_files[f].path)
        result = []

        if all_files:
            max_name_length = max([len(all_files[fname].path)
                                   for fname in all_files]) + 2

        for fname in all_files_sorted:
            if (not clouseau.retention.utils.fileutils.contains(
                    all_files[fname].filetype,
                    clouseau.retention.utils.config.conf['ignored_types']) and
                    not all_files[fname].is_empty):
                result.append(all_files[fname].format_output(
                    self.show_sample_content, False,
                    max_name_length))
        output = "\n".join(self.warnings + result) + "\n"
        return output
    def do_local_audit(self):
        open_files = clouseau.retention.utils.fileutils.get_open_files()

        all_files = {}
        files = self.find_all_files()

        magic = clouseau.retention.utils.magic.magic_open(
            clouseau.retention.utils.magic.MAGIC_NONE)
        magic.load()
        today = time.time()
        for (fname, fstat) in files:
            all_files[fname] = FileInfo(fname, magic, fstat)
            all_files[fname].load_file_info()
            all_files[fname].load_extra_file_info(
                today, clouseau.retention.utils.config.conf['cutoff'],
                open_files)

        all_files_sorted = sorted(all_files, key=lambda f: all_files[f].path)
        result = []

        if all_files:
            max_name_length = max(
                [len(all_files[fname].path) for fname in all_files]) + 2

        for fname in all_files_sorted:
            if (not clouseau.retention.utils.fileutils.contains(
                    all_files[fname].filetype,
                    clouseau.retention.utils.config.conf['ignored_types'])
                    and not all_files[fname].is_empty):
                result.append(all_files[fname].format_output(
                    self.show_sample_content, False, max_name_length))
        output = "\n".join(self.warnings + result) + "\n"
        return output
    def get_all_files(self, cutoff, open_files, rotated):
        all_files = {}
        files = self.find_all_files()

        magic = clouseau.retention.utils.magic.magic_open(clouseau.retention.utils.magic.MAGIC_NONE)
        magic.load()
        today = time.time()
        for (fname, stat) in files:
            all_files[fname] = LogInfo(fname, magic, stat)
            all_files[fname].load_file_info()
            all_files[fname].load_extra_file_info(today, cutoff, open_files)
            all_files[fname].get_rotated(rotated)
        return all_files