Esempio n. 1
0
def status(args, DS_URL):
    """display status of datasources"""
    if 1 < len(args):
        raise Exception("wrong number of args for showing DataSource status")

    i = get_id(parse_opts(args))

    if (i is not None):
        url = DS_URL + '/' + i + '/status'
        data = json_http(url)
        print "Status of DataSource #" + i + ": " + url + " => " + pretty_json(
            data)

    else:
        url = DS_URL + "/all/status"
        data = json_http(url)
        print "Status of All DataSources: " + url + " => " + pretty_json(data)
Esempio n. 2
0
def print_ds(data, DS_URL, indent=''):
    i = str(data['id'])
    dsu = DS_URL + '/' + i

    print indent + "Data Source #" + i + ': '
    indent = indent + '  '

    print indent + "Info: " + dsu + ' => ' + pretty_json(data, indent)

    status_url = dsu + "/status"
    status = json_http(status_url)
    print indent + "Status: " + status_url + " => " + pretty_json(
        status, indent)

    sched_url = dsu + "/schedule"
    sched = json_http(sched_url)
    print indent + "Schedule: " + sched_url + " => " + pretty_json(
        sched, indent)
def show(args, SETTINGS_URL):
    """display settings """

    label = 'Index Settings'
    url = SETTINGS_URL
    if (0 < len(args)): 
        label += ' (' + ', '.join(args) + ')'
        url += '/' + ','.join(args)
    data = json_http(url)
    print label + ': ' + url + ' => ' + pretty_json(data)
Esempio n. 4
0
def show(args, COL_URL):
    """display current collection info"""

    label = 'Collection Info'
    url = COL_URL + "/info"
    if (0 < len(args)):
        label += ' (' + ', '.join(args) + ')'
        url += '/' + ','.join(args)
    data = json_http(url)
    print label + ": " + url + " => " + pretty_json(data)
Esempio n. 5
0
def show(args, FIELDS_URL):
    """display current fields"""
    if 1 < len(args):
        raise Exception("wrong number of args for showing fields")

    if (0 < len(args)):
        name = args.pop(0)
        # be helpful if they get the syntax confused
        if (0 == name.find('name=')): name = name.replace('name=', '', 1)
        url = FIELDS_URL + "/" + name
        data = json_http(url)
        print "Field " + name + ": " + url + " => " + pretty_json(data, '  ')
    else:
        print 'Fields: ' + FIELDS_URL
        data = json_http(FIELDS_URL)
        if 0 == len(data):
            print '  (none)'
        else:
            for field in data:
                name = field['name']
                url = FIELDS_URL + '/' + name
                print "  Field: " + name + ": " + url + " => " + pretty_json(
                    field, '  ')
Esempio n. 6
0
def history(args, DS_URL):
    """display the indexing history of a datasource"""

    if 1 != len(args):
        raise Exception("wrong number of args for showing a DataSource")

    i = get_id(parse_opts(args))
    if i is None:
        raise Exception(
            "Must supply either an id or a name to view the indexing history of a DataSource"
        )

    url = DS_URL + "/" + i + '/history'
    data = json_http(url)
    print "History of DataSource #" + i + ": " + url + " => " + pretty_json(
        data)