def find_hosts_by_staleness(staleness, query): logger.debug("find_hosts_by_staleness(%s)", staleness) config = inventory_config() staleness_conditions = tuple(staleness_to_conditions(config, staleness, stale_timestamp_filter)) if "unknown" in staleness: staleness_conditions += (Host.stale_timestamp == NULL,) return query.filter(or_(*staleness_conditions))
def staleness_filter(staleness): config = inventory_config() return staleness_to_conditions(config, staleness, _stale_timestamp_filter)