def _ensure_console_pid_dir_exists():

    dir = _get_console_pid_dir()
    if not os.path.exists(dir):
        try:
            os.makedirs(dir)
        except OSError as exc:
            msg = (_("Cannot create directory '%(path)s' for console PID file."
                     " Reason: %(reason)s.") % {'path': dir, 'reason': exc})
            LOG.error(msg)
            raise exception.ConsoleError(message=msg)
Ensure that the console PID directory exists
dataset/ETHPy150Open openstack/ironic/ironic/drivers/modules/console_utils.py/_ensure_console_pid_dir_exists