示例#1
0
def __find_mirror_sort(sort_field, mirrors=None, reverse=False):
    """ Find the first mirror that is sorted by sort_field """
    results = mirror_statuses(mirrors=mirrors, ping_master_mirror=False)
    new_list = sorted(results,
                      key=operator.itemgetter(sort_field),
                      reverse=reverse)
    return new_list[0]
示例#2
0
def find_out_of_date_mirrors(mirrors=None):
    """ Find the mirrors that are out of date """
    results = mirror_statuses(mirrors=mirrors)
    bad_mirrors = []
    for r in results:
        if r.get('status') == STATUSES.get('RED'):
            bad_mirrors.append(r)
    return bad_mirrors
示例#3
0
def find_out_of_date_mirrors(mirrors=None):
    """ Find the mirrors that are out of date """
    results = mirror_statuses(mirrors=mirrors)
    bad_mirrors = []
    for r in results:
        if r.get('status') == STATUSES.get('RED'):
            bad_mirrors.append(r)
    return bad_mirrors
示例#4
0
def run():
    """ run everything """
    results = mirror_statuses(mirrors=MIRRORS)
    if results:
        time_now = results[0].get('time_now', None)
    data = process_results(results)
    json_data = json_results(data)

    store_json_data(json_data)
    store_page_data(data, time_now)
示例#5
0
def run():
    """ run everything """
    results = mirror_statuses(mirrors=MIRRORS)
    if results:
        time_now = results[0].get('time_now', None)
    data = process_results(results)
    json_data = json_results(data)

    store_json_data(json_data)
    store_page_data(data, time_now)
示例#6
0
def run():
    """ run everything """
    results = mirror_statuses(mirrors=MIRRORS)
    if results:
        time_now = results[0].get('time_now', None)
    data = process_results(results)

    env = Environment(loader=FileSystemLoader('templates'))
    # add the dummy url_for so it doesn't throw error.
    env.globals.update(url_for=url_for)
    template = env.get_template('index.html')
    context = {'data': data, 'date_now': time_now}
    print template.render(**context)
示例#7
0
def run():
    """ run everything """
    results = mirror_statuses(mirrors=MIRRORS)
    if results:
        time_now = results[0].get('time_now', None)
    data = process_results(results)

    env = Environment(loader=FileSystemLoader('templates'))
    # add the dummy url_for so it doesn't throw error.
    env.globals.update(url_for=url_for)
    template = env.get_template('index.html')
    context = {'data': data, 'date_now': time_now}
    print template.render(**context)
示例#8
0
def __find_mirror_sort(sort_field, mirrors=None, reverse=False):
    """ Find the first mirror that is sorted by sort_field """
    results = mirror_statuses(mirrors=mirrors, ping_master_mirror=False)
    new_list = sorted(results, key=operator.itemgetter(sort_field), reverse=reverse)
    return new_list[0]