Reboot a container.


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

        .. versionadded:: 2015.8.0

    CLI Examples:

    .. code-block:: bash

        salt 'minion' lxc.reboot myvm

def reboot(name, path=None):
    '''
    Reboot a container.


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

        .. versionadded:: 2015.8.0

    CLI Examples:

    .. code-block:: bash

        salt 'minion' lxc.reboot myvm

    '''
    ret = {'result': True,
           'changes': {},
           'comment': '{0} rebooted'.format(name)}
    does_exist = exists(name, path=path)
    if does_exist and (state(name, path=path) == 'running'):
        try:
            stop(name, path=path)
        except (SaltInvocationError, CommandExecutionError) as exc:
            ret['comment'] = 'Unable to stop container: {0}'.format(exc)
            ret['result'] = False
            return ret
    if does_exist and (state(name, path=path) != 'running'):
        try:
            start(name, path=path)
        except (SaltInvocationError, CommandExecutionError) as exc:
            ret['comment'] = 'Unable to stop container: {0}'.format(exc)
            ret['result'] = False
            return ret
    ret['changes'][name] = 'rebooted'
    return ret