def beacon(config):
    '''
    Emit the status of a connected display to the minion

    Mainly this is used to detect when the display fails to connect
    for whatever reason.

    .. code-block:: yaml

        beacons:
          glxinfo:
            - user: frank
            - screen_event: True

    '''

    log.trace('glxinfo beacon starting')
    ret = []

    _config = {}
    list(map(_config.update, config))

    retcode = __salt__['cmd.retcode']('DISPLAY=:0 glxinfo',
                                      runas=_config['user'], python_shell=True)

    if 'screen_event' in _config and _config['screen_event']:
        last_value = last_state.get('screen_available', False)
        screen_available = retcode == 0
        if last_value != screen_available or 'screen_available' not in last_state:
            ret.append({'tag': 'screen_event', 'screen_available': screen_available})

        last_state['screen_available'] = screen_available

    return ret
def beacon ( config ) : log . trace ( 'glxinfo beacon starting' ) ret = [ ] _config = { } list ( map ( _config . update , config ) ) retcode = __salt__ [ 'cmd.retcode' ] ( 'DISPLAY=:0 glxinfo' , runas = _config [ 'user' ] , python_shell = True ) if 'screen_event' in _config and _config [ 'screen_event' ] : last_value = last_state . get ( 'screen_available' , False ) screen_available = retcode == 0 if last_value != screen_available or 'screen_available' not in last_state : ret . append ( { 'tag' : 'screen_event' , 'screen_available' : screen_available } ) last_state [ 'screen_available' ] = screen_available return ret
Emit the status of a connected display to the minion

    Mainly this is used to detect when the display fails to connect
    for whatever reason.

    .. code-block:: yaml

        beacons:
          glxinfo:
            - user: frank
            - screen_event: True