Return a dict of managed keys under a named status
8790
def list_status(self, match):
        '''
        
        '''
        acc, pre, rej, den = self._check_minions_directories()
        ret = {}
        if match.startswith('acc'):
            ret[os.path.basename(acc)] = []
            for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(acc)):
                if not fn_.startswith('.'):
                    if os.path.isfile(os.path.join(acc, fn_)):
                        ret[os.path.basename(acc)].append(fn_)
        elif match.startswith('pre') or match.startswith('un'):
            ret[os.path.basename(pre)] = []
            for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(pre)):
                if not fn_.startswith('.'):
                    if os.path.isfile(os.path.join(pre, fn_)):
                        ret[os.path.basename(pre)].append(fn_)
        elif match.startswith('rej'):
            ret[os.path.basename(rej)] = []
            for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(rej)):
                if not fn_.startswith('.'):
                    if os.path.isfile(os.path.join(rej, fn_)):
                        ret[os.path.basename(rej)].append(fn_)
        elif match.startswith('den') and den is not None:
            ret[os.path.basename(den)] = []
            for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(den)):
                if not fn_.startswith('.'):
                    if os.path.isfile(os.path.join(den, fn_)):
                        ret[os.path.basename(den)].append(fn_)
        elif match.startswith('all'):
            return self.all_keys()
        return ret
1224285
def get_device_status(self, t):
        ''''''
        data = {}
        for name, (func, _, _) in self.addons.iteritems():
            data[name] = func(t)
        return data
1170570
def _get_paths_for_status(self, status):
        
        added, modified, deleted = self._changes_cache
        return sorted({
            'added': list(added),
            'modified': list(modified),
            'deleted': list(deleted)}[status]
        )
1219022
def get_state_batch(keys, namespace=None, consistent=True):
    """"""

    ukeys = set(keys)

    if namespace:
        ns_keys = ["{}:{}".format(namespace, key) for key in ukeys]

    uvalues = {k: v for k, v
               in zip(ukeys, get_item_batch(ns_keys, consistent=consistent))}
    return list(zip(keys, (uvalues[k] for k in keys)))
47875
def get_active_queue(self):
        """"""

        # Get dict of active queues keyed by name
        queues = {q['jobQueueName']: q for q in self._client.describe_job_queues()['jobQueues']
                  if q['state'] == 'ENABLED' and q['status'] == 'VALID'}
        if not queues:
            raise Exception('No job queues with state=ENABLED and status=VALID')

        # Pick the first queue as default
        return list(queues.keys())[0]
193875
def managed(name, servers=None):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'NTP servers already configured as specified'}

    if not _check_servers(servers):
        ret['result'] = False
        ret['comment'] = 'NTP servers must be a list of strings'

    before_servers = _get_servers()
    desired_servers = set(servers)

    if before_servers == desired_servers:
        return ret

    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = ('NTP servers will be updated to: {0}'
                          .format(', '.join(sorted(desired_servers))))
        return ret

    __salt__['ntp.set_servers'](*desired_servers)
    after_servers = _get_servers()

    if after_servers == desired_servers:
        ret['comment'] = 'NTP servers updated'
        ret['changes'] = {'old': sorted(before_servers),
                          'new': sorted(after_servers)}
    else:
        ret['result'] = False
        ret['comment'] = 'Failed to update NTP servers'
        if before_servers != after_servers:
            ret['changes'] = {'old': sorted(before_servers),
                              'new': sorted(after_servers)}

    return ret
601793
def _get_redis_keys_opts():
    '''
    
    '''
    return {
        'bank_prefix': __opts__.get('cache.redis.bank_prefix', _BANK_PREFIX),
        'bank_keys_prefix': __opts__.get('cache.redis.bank_keys_prefix', _BANK_KEYS_PREFIX),
        'key_prefix': __opts__.get('cache.redis.key_prefix', _KEY_PREFIX),
        'separator': __opts__.get('cache.redis.separator', _SEPARATOR)
    }
1228257
def getLockStatsDB(self):
        
        info_dict = {'all': {},
                     'wait': {}}
        cur = self._conn.cursor()
        cur.execute("SELECT d.datname, l.granted, COUNT(*) FROM pg_database d "
                    "JOIN pg_locks l ON d.oid=l.database "
                    "GROUP BY d.datname, l.granted;")
        rows = cur.fetchall()
        for (db, granted, cnt) in rows:
            info_dict['all'][db] = info_dict['all'].get(db, 0) + cnt
            if not granted:
                info_dict['wait'][db] = info_dict['wait'].get(db, 0) + cnt
        return info_dict
771210
def get_all_keys(self, headers=None, **params):
        
        key = Key(self.name, self.contained_key)
        return SimpleResultSet([key])
737848
def _systemctl_status(name):
    '''
    
    '''
    contextkey = 'systemd._systemctl_status.%s' % name
    if contextkey in __context__:
        return __context__[contextkey]
    __context__[contextkey] = __salt__['cmd.run_all'](
        _systemctl_cmd('status', name),
        python_shell=False,
        redirect_stderr=True,
        ignore_retcode=True
    )
    return __context__[contextkey]
40989
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'environment_id') and self.environment_id is not None:
            _dict['environment_id'] = self.environment_id
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        return _dict
1016603
def to_vars_dict(self):
        
        return {
            'aws_access_key_id':      self._access_key,
            'aws_secret_access_key':  self._secret_key,
            'aws_region':             self._region_name,
            'aws_vpc_name':           (self._vpc or ''),
            'aws_vpc_id':             (self._vpc_id or ''),
        }
1352556
def mpstatus_to_json(status):
    ''''''
    msg_keys = list(status.msgs.keys())
    data = '{'
    for key in msg_keys[:-1]:
        data += mavlink_to_json(status.msgs[key]) + ','
    data += mavlink_to_json(status.msgs[msg_keys[-1]])
    data += '}'
    return data
58882
def getStats(self):
        
        info_dict = {}
        args = [varnishstatCmd, '-1']
        if self._instance is not None:
            args.extend(['-n', self._instance])
        output = util.exec_command(args)
        if self._descDict is None:
            self._descDict = {}
        for line in output.splitlines():
            mobj = re.match('(\S+)\s+(\d+)\s+(\d+\.\d+|\.)\s+(\S.*\S)\s*$', 
                            line)
            if mobj:
                fname = mobj.group(1).replace('.', '_')
                info_dict[fname] = util.parse_value(mobj.group(2))
                self._descDict[fname] = mobj.group(4)
        return info_dict
1337354
def get_gsi_status(table_name, gsi_name):
    
    try:
        desc = DYNAMODB_CONNECTION.describe_table(table_name)
    except JSONResponseError:
        raise

    for gsi in desc[u'Table'][u'GlobalSecondaryIndexes']:
        if gsi[u'IndexName'] == gsi_name:
            return gsi[u'IndexStatus']
72742
def getsshkeys(self):
        
        request = requests.get(
            self.keys_url, headers=self.headers, verify=self.verify_ssl, auth=self.auth, timeout=self.timeout)

        if request.status_code == 200:
            return request.json()
        else:
            return False
1317917
def get_status(self, hosts, services):
        
        if self.got_business_rule:
            mapping = {
                0: "UP",
                1: "DOWN",
                4: "UNREACHABLE",
            }
            return mapping.get(self.business_rule.get_state(hosts, services), "n/a")

        return self.state