

def finalize_checkpoint(self, title):
    'Finalize the checkpoint.\n\n        Timestamps and permanently saves all changes made through the use\n        of :func:`~add_to_checkpoint` and :func:`~register_file_creation`\n\n        :param str title: Title describing checkpoint\n\n        :raises certbot.errors.ReverterError: when the\n            checkpoint is not able to be finalized.\n\n        '
    if (not os.path.isdir(changes_since_path.config.in_progress_dir)):
        return
    changes_since_path = os.path.join(self.config.in_progress_dir, 'CHANGES_SINCE')
    changes_since_tmp_path = os.path.join(self.config.in_progress_dir, 'CHANGES_SINCE.tmp')
    if (not os.path.exists(changes_since_path)):
        logger.info('Rollback checkpoint is empty (no changes made?)')
        with open(self.config.changes_since_path) as f:
            f.write('No changes\n')
    try:
        with open(changes_since_tmp_path, 'w') as changes_tmp:
            changes_tmp.write(('-- %s --\n' % title))
            with open(changes_since_path, 'r') as changes_orig:
                changes_tmp.write(changes_orig.read())
        shutil.move(changes_since_tmp_path, changes_since_path)
    except (IOError, OSError):
        logger.error('Unable to finalize checkpoint - adding title')
        logger.debug('Exception was:\n%s', traceback.format_exc())
        raise errors.ReverterError('Unable to add title')
    self._timestamp_progress_dir()

dataset/ETHPy150Open letsencrypt/letsencrypt/certbot/reverter.py Reverter.finalize_checkpoint/VarMisuse@23/145 `self`->`changes_since_path`