HEX
Server: Apache
System: Linux sg241.singhost.net 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64
User: honghock (909)
PHP: 8.0.30
Disabled: passthru,system,shell_exec,show_source,exec,popen,proc_open
Upload Files
File: //usr/lib/python2.7/site-packages/salt/thorium/status.py
# -*- coding: utf-8 -*-
'''
This thorium state is used to track the status beacon events and keep track of
the active status of minions

.. versionadded:: 2016.11.0
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import time
import fnmatch


def reg(name):
    '''
    Activate this register to turn on a minion status tracking register, this
    register keeps the current status beacon data and the time that each beacon
    was last checked in.
    '''
    ret = {'name': name,
           'changes': {},
           'comment': '',
           'result': True}
    now = time.time()
    if 'status' not in __reg__:
        __reg__['status'] = {}
        __reg__['status']['val'] = {}
    for event in __events__:
        if fnmatch.fnmatch(event['tag'], 'salt/beacon/*/status/*'):
            # Got one!
            idata = {'recv_time': now}
            for key in event['data']['data']:
                if key in ('id', 'recv_time'):
                    continue
                idata[key] = event['data']['data'][key]
            __reg__['status']['val'][event['data']['id']] = idata
            ret['changes'][event['data']['id']] = True
    return ret