Beispiel #1
0
def get_monthly_create_options(username, package_id):
    mgr = get_hardware_manager()
    results = mgr.get_dedicated_server_create_options(package_id)

    package = get_client()["Product_Package"].getObject(id=package_id, mask="mask[id,name]")
    results["package_id"] = package_id
    results["package_name"] = package["name"]

    # Sort locations by their long name
    results["locations"] = sorted(results["locations"], key=lambda x: x["long_name"])

    groups = {}

    # Sort items within each category by the sort key, then the capacity key
    for k, v in results["categories"].items():
        group = v["group"] or "Miscellaneous"
        if group not in groups:
            groups[group] = {}
        items = multikeysort(v["items"], ["sort", "capacity", "recurring_fee"])
        v["items"] = items
        groups[group][k] = v
        # results['categories'][k]['items'] = items

    results["groups"] = groups

    return results
Beispiel #2
0
def get_monthly_create_options(username, package_id):
    mgr = get_hardware_manager()
    results = mgr.get_dedicated_server_create_options(package_id)

    package = get_client()['Product_Package'].getObject(id=package_id,
                                                        mask="mask[id,name]")
    results['package_id'] = package_id
    results['package_name'] = package['name']

    # Sort locations by their long name
    results['locations'] = sorted(results['locations'],
                                  key=lambda x: x['long_name'])

    groups = {}

    # Sort items within each category by the sort key, then the capacity key
    for k, v in results['categories'].items():
        group = v['group'] or 'Miscellaneous'
        if group not in groups:
            groups[group] = {}
        items = multikeysort(v['items'], ['sort', 'capacity', 'recurring_fee'])
        v['items'] = items
        groups[group][k] = v
        #results['categories'][k]['items'] = items

    results['groups'] = groups

    return results
Beispiel #3
0
def get_hourly_create_options(username):
    results = get_hardware_manager().get_bare_metal_create_options()

    # Sort locations by their long name
    results["locations"] = sorted(results["locations"], key=lambda x: x["long_name"])

    # Sort items within each category by the sort key, then the capacity key
    for k, v in results["categories"].items():
        items = multikeysort(v["items"], ["sort", "capacity"])
        results["categories"][k]["items"] = items

    # Deleting the 'other' category since we don't need it
    if results["categories"].get("other"):
        del (results["categories"]["other"])
    return results
Beispiel #4
0
def get_hourly_create_options(username):
    results = get_hardware_manager().get_bare_metal_create_options()

    # Sort locations by their long name
    results['locations'] = sorted(results['locations'],
                                  key=lambda x: x['long_name'])

    # Sort items within each category by the sort key, then the capacity key
    for k, v in results['categories'].items():
        items = multikeysort(v['items'], ['sort', 'capacity'])
        results['categories'][k]['items'] = items

    # Deleting the 'other' category since we don't need it
    if results['categories'].get('other'):
        del (results['categories']['other'])
    return results