Ejemplo n.º 1
0
def cli_reset():
    check_cli_ip("/api/cli/reset")
    return None

    for instanceid, instance in Instance.objects().items():
        instance.cheapskate["grp"] = "1"

    Instance.save_all()

    return "Instances reset"
Ejemplo n.º 2
0
def cli_reset():
    check_cli_ip("/api/cli/reset")
    return None

    for instanceid, instance in Instance.objects().items():
        instance.cheapskate["grp"] = "1"

    Instance.save_all()

    return "Instances reset"
Ejemplo n.º 3
0
def cli_shutdown():
    check_cli_ip("/api/cli/shutdown")
    result = {}

    instances = json.load(open("shutdown_due.json"))
    if len(instances) == 0:
        return "No shutdowns required"

    for instance in instances:
        result[instance["id"]] = Instance.objects()[instance["id"]].shutdown()

    return result
Ejemplo n.º 4
0
def cli_shutdown():
    check_cli_ip("/api/cli/shutdown")
    result = {}

    instances = json.load(open("shutdown_due.json"))
    if len(instances) == 0:
        return "No shutdowns required"

    for instance in instances:
        result[instance["id"]] = Instance.objects()[instance["id"]].shutdown()

    return result
Ejemplo n.º 5
0
def ec2_instance_update(instance_id):
    instance = Instance.objects()[instance_id]
    hours = request.forms.get("hours")
    user = request.headers.get("Remote-User")
    instance.update(user=user, hours=int(hours))
    return json.dumps(instance.as_dict())
Ejemplo n.º 6
0
def ec2_instance(instance_id):
    return Instance.objects()[instance_id].as_dict()
Ejemplo n.º 7
0
def ec2_tag_volumes(instance_id, tagname):
    check_cli_ip("/api/tag")
    Instance.objects()[instance_id].update_volume_tags(tagname)

    return "All instance voluems updated"
Ejemplo n.º 8
0
def ec2_tag_instance(instance_id, tag, name):
    check_cli_ip("/api/tag")
    return Instance.objects()[instance_id].tag_instance(tag, name)
Ejemplo n.º 9
0
def ec2_instance_update(instance_id):
    instance = Instance.objects()[instance_id]
    hours = request.forms.get("hours")
    user = request.headers.get("Remote-User")
    instance.update(user=user, hours=int(hours))
    return json.dumps(instance.__dict__())
Ejemplo n.º 10
0
def ec2_instance(instance_id):
    return Instance.objects()[instance_id].__dict__()