Ejemplo n.º 1
0
def print_fias_versions():
    imp = SoapReceiver()
    current_version = Updater.get_current_fias_version()
    all_versions = imp.get_update_list()

    print("Installed version: {}".format(current_version))
    print("Avaliable updates:")
    print("Number\t\tDate")
    for upd in all_versions:
        mark_current = (' ', '*')[int(upd['intver']) == current_version]
        print("{}{}\t\t{}".format(mark_current, upd['intver'], upd['strver']))
Ejemplo n.º 2
0
def get_allowed_updates(updates_str, mode="create"):
    imp = SoapReceiver()
    current_version = Updater.get_current_fias_version()
    all_versions = [x for x in imp.get_update_list()]

    user_defined_list = parse_update_str(updates_str)
    out_list = []

    if mode == "create":
        if not user_defined_list:
            yield all_versions[-1]
        else:
            assert len(user_defined_list) == 1, "Ony single update number allowed for DB create"
    if mode == "update":
        for uv in all_versions:
            uv_ver = uv['intver']
            if uv_ver > current_version and (not user_defined_list or uv_ver in user_defined_list):
                out_list.append(uv)

        out_list.sort(key=lambda item: item['intver'])
        for ol_entry in out_list:
            yield ol_entry