Beispiel #1
0
def make_policies(limits):
    policies = {}
    for (name, member_capacity, project_capacity) in limits:
        try:
            member_capacity = units.parse(member_capacity)
            project_capacity = units.parse(project_capacity)
        except units.ParseError:
            m = "Please specify capacity as a decimal integer"
            raise CommandError(m)
        policies[name] = {"member_capacity": member_capacity,
                          "project_capacity": project_capacity}
    return policies
Beispiel #2
0
def make_policies(limits):
    policies = {}
    for (name, member_capacity, project_capacity) in limits:
        try:
            member_capacity = units.parse(member_capacity)
            project_capacity = units.parse(project_capacity)
        except units.ParseError:
            m = "Please specify capacity as a decimal integer"
            raise CommandError(m)
        policies[name] = {"member_capacity": member_capacity,
                          "project_capacity": project_capacity}
    return policies
Beispiel #3
0
def parse_with_unit(value):
    try:
        return units.parse(value)
    except units.ParseError:
        raise CommandError("Failed to parse value, should be an integer, "
                           "possibly followed by a unit, or 'inf'.")
Beispiel #4
0
def parse_with_unit(value):
    try:
        return units.parse(value)
    except units.ParseError:
        raise CommandError("Failed to parse value, should be an integer, "
                           "possibly followed by a unit, or 'inf'.")
Beispiel #5
0
def _parse_max_members(s):
    try:
        return units.parse(s)
    except units.ParseError:
        raise faults.BadRequest("Invalid max_members")
Beispiel #6
0
def _parse_max_members(s):
    try:
        return units.parse(s)
    except units.ParseError:
        raise faults.BadRequest("Invalid max_members")