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/grains/marathon.py
# -*- coding: utf-8 -*-
'''
Generate marathon proxy minion grains.

.. versionadded:: 2015.8.2

'''
from __future__ import absolute_import, print_function, unicode_literals

import salt.utils.http
import salt.utils.platform
__proxyenabled__ = ['marathon']
__virtualname__ = 'marathon'


def __virtual__():
    if salt.utils.platform.is_proxy() and 'proxy' in __opts__ and __opts__['proxy'].get('proxytype') == 'marathon':
        return __virtualname__
    return False


def kernel():
    return {'kernel': 'marathon'}


def os():
    return {'os': 'marathon'}


def os_family():
    return {'os_family': 'marathon'}


def os_data():
    return {'os_data': 'marathon'}


def marathon():
    response = salt.utils.http.query(
        "{0}/v2/info".format(__opts__['proxy'].get(
            'base_url',
            "http://locahost:8080",
        )),
        decode_type='json',
        decode=True,
    )
    if not response or 'dict' not in response:
        return {'marathon': None}
    return {'marathon': response['dict']}