def wait_started(name, path=None, timeout=300):
    '''
    Check that the system has fully inited

    This is actually very important for systemD based containers

    see https://github.com/saltstack/salt/issues/23847

    path
        path to the container parent
        default: /var/lib/lxc (system default)

        .. versionadded:: 2015.8.0

    CLI Example:

    .. code-block:: bash

        salt myminion lxc.wait_started ubuntu

    '''
    if not exists(name, path=path):
        raise CommandExecutionError(
            'Container {0} does does exists'.format(name))
    if not state(name, path=path) == 'running':
        raise CommandExecutionError(
            'Container {0} is not running'.format(name))
    ret = False
    if running_systemd(name, path=path):
        test_started = test_sd_started_state
        logger = log.error
    else:
        test_started = test_bare_started_state
        logger = log.debug
    now = time.time()
    expire = now + timeout
    now = time.time()
    started = test_started(name, path=path)
    while time.time() < expire and not started:
        time.sleep(0.3)
        started = test_started(name, path=path)
    if started is None:
        logger(
            'Assuming {0} is started, although we failed to detect that'
            ' is fully started correctly'.format(name))
        ret = True
    else:
        ret = started
    return ret
dataset/ETHPy150Open saltstack/salt/salt/modules/lxc.py/wait_started/original