Read pillar data from Cobbler via its API.

def ext_pillar(minion_id,
               pillar,  # pylint: disable=W0613
               key=None,
               only=()):
    '''
    Read pillar data from Cobbler via its API.
    '''
    url = __opts__['cobbler.url']
    user = __opts__['cobbler.user']
    password = __opts__['cobbler.password']

    log.info("Querying cobbler at %r for information for %r", url, minion_id)
    try:
        server = salt.ext.six.moves.xmlrpc_client.Server(url, allow_none=True)
        if user:
            server.login(user, password)
        result = server.get_blended_data(None, minion_id)
    except Exception:
        log.exception(
            'Could not connect to cobbler.'
        )
        return {}

    if only:
        result = dict((k, result[k]) for k in only if k in result)

    if key:
        result = {key: result}
    return result