def process(self, context, ticket_location):
"""This method runs once on each ticket.
Note that this method runs inside a threadpool.
"""
components = ticket_location.to_path().split("/")
# Ensure the ticket location matches the ticket content.
if (components[-2] != self.client_id or
components[-3] != self.__class__.__name__):
raise IOError("Ticket location unexpected.")
# Verify the client id and public key match.
if self.public_key.client_id() != self.client_id:
raise crypto.CipherError("Public key incompatible with client_id")
# Update the client's record by deleting the old one and inserting a new
# one.
context["messages"].append(
dict(client_id=self.client_id,
fqdn=self.system_info.fqdn,
system=self.system_info.system,
architecture=self.system_info.architecture,
boot_time=self.boot_time,
agent_start_time=self.agent_start_time,
)
)
# Modify the client record atomically.
self._config.server.client_record_for_server(
self.client_id).read_modify_write(self._update_client_record)
评论列表
文章目录