def write(self, path=None):
"""Writes the ticket to /var/spool/ticket/<princ>."""
def _write_temp(tkt_file):
# Write the file
tkt_file.write(self.ticket)
# Set the owner
if self.uid is not None:
os.fchown(tkt_file.fileno(), self.uid, -1)
# TODO: Should we enforce the mode too?
tkt_file.flush()
if path is None:
path = self.tkt_path
try:
fs.write_safe(
path,
_write_temp,
prefix='.tmp' + self.princ
)
except (IOError, OSError):
_LOGGER.exception('Error writing ticket file: %s', path)
评论列表
文章目录