Exemplo n.º 1
0
def logaudit_host(confdir, oldest, show_content, show_system_logs,
                  dirsizes, depth,
                  to_check, ignore_also,
                  maxfiles):
    lauditor = LocalLogsAuditor('logs', confdir, oldest, show_content,
                                show_system_logs,
                                dirsizes, depth, to_check,
                                ignore_also, maxfiles)
    result = lauditor.do_local_audit()
    return result
Exemplo n.º 2
0
    def entry_is_not_ignored(self, path, entrytype, do_check):
        '''
        see if the given entry is in NOT in the ingored lists and return
        True if so, False otherwise
        we only do this check if the do_check argment is set to 'check';
        otherwise we default to True
        '''
        if do_check != 'check':
            return True

        basedir = self.get_basedir_from_path(path)
        if self.audit_type == 'logs' and entrytype == 'file':
            path = LocalLogsAuditor.normalize(path)

        if entrytype == 'file':
            checker = clouseau.retention.utils.ignores.file_is_ignored
            dirs = False
        else:
            checker = clouseau.retention.utils.ignores.dir_is_ignored
            dirs = True
            for ignored in [self.ignores.global_ignored, self.ignored_also]:
                if dirs:
                    result = checker(path, ignored)
                else:
                    result = checker(path, basedir, ignored)
                if result:
                    return False

            for ignored in [
                    self.ignores.perhost_ignored, self.ignored_from_rulestore
            ]:
                if self.cenv.host in ignored:
                    if dirs:
                        result = checker(path, ignored[self.cenv.host])
                    else:
                        result = checker(path, basedir,
                                         ignored[self.cenv.host])
                    if result:
                        return False

        return True
Exemplo n.º 3
0
    def entry_is_not_ignored(self, path, entrytype, do_check):
        '''
        see if the given entry is in NOT in the ingored lists and return
        True if so, False otherwise
        we only do this check if the do_check argment is set to 'check';
        otherwise we default to True
        '''
        if do_check != 'check':
            return True

        basedir = self.get_basedir_from_path(path)
        if self.audit_type == 'logs' and entrytype == 'file':
            path = LocalLogsAuditor.normalize(path)

        if entrytype == 'file':
            checker = clouseau.retention.utils.ignores.file_is_ignored
            dirs = False
        else:
            checker = clouseau.retention.utils.ignores.dir_is_ignored
            dirs = True
            for ignored in [self.ignores.global_ignored,
                            self.ignored_also]:
                if dirs:
                    result = checker(path, ignored)
                else:
                    result = checker(path, basedir, ignored)
                if result:
                    return False

            for ignored in [self.ignores.perhost_ignored,
                            self.ignored_from_rulestore]:
                if self.cenv.host in ignored:
                    if dirs:
                        result = checker(path, ignored[self.cenv.host])
                    else:
                        result = checker(path, basedir, ignored[self.cenv.host])
                    if result:
                        return False

        return True
Exemplo n.º 4
0
 def get_local_auditor(self):
     return LocalLogsAuditor(self.audit_type, self.confdir,
                             self.oldest_only, self.show_system_logs,
                             self.show_sample_content, self.dirsizes,
                             self.depth, self.to_check, self.ignore_also,
                             self.max_files)