Пример #1
0
Файл: ec2.py Проект: ahua/python
def sync_env_ip(confset, server=None, role=None):
    cp = load_confset_config(confset)
    conn = _ensure_aws_access(confset, cp)
    instances_dict = _prepare_instances(conn)

    cpw = open_confset_config(confset)
    if server:
        _sync_server_ip(cpw, server, instances_dict)
    elif role:
        _sync_role_ip(cpw, role, instances_dict)
    else:
        servers = cpw.sections()
        for server in servers:
            _sync_server_ip(cpw, server, instances_dict)

    write_confset_config(confset, cpw)
Пример #2
0
Файл: ec2.py Проект: ahua/python
def upgrade_env(confset, instance_type, server=None, role=None):
    global _confset
    _confset = confset
    cp = load_confset_config(confset)
    conn = _ensure_aws_access(confset, cp)
    instances_dict = _prepare_instances(conn)

    cpw = open_confset_config(confset)
    if server:
        _upgrade_server(cpw, server, instance_type, instances_dict)
    elif role:
        _upgrade_role(cpw, role, instance_type, instances_dict)
    else:
        servers = cp.sections()
        for server in servers:
            _upgrade_server(cpw, server, instance_type, instances_dict)
    write_confset_config(confset, cpw)
    _confset = None