class FactLib(DataLib): """ Used by CertManager to update a system's facts with the server, used primarily by the cron job but in a couple other places as well. Makes use of the facts module as well. """ def __init__(self, lock=None, uep=None, facts=None): DataLib.__init__(self, lock, uep) self.facts = facts if not self.facts: self.facts = Facts() def _do_update(self): updates = 0 # figure out the diff between latest facts and # report that as updates if self.facts.has_changed(): updates = len(self.facts.get_facts()) if not ConsumerIdentity.exists(): return updates consumer = ConsumerIdentity.read() consumer_uuid = consumer.getConsumerId() self.facts.update_check(self.uep, consumer_uuid) else: log.info("Facts have not changed, skipping upload.") return updates