def _read_user_instance_mappings()

in ec2stack/configure.py [0:0]


def _read_user_instance_mappings(config, profile):
    """
    Add instance type mappings to profile.

    @param config: current configparser configuration.
    @param profile: the profile to set the attribute in.
    @return: configparser configuration.
    """
    instance_section = profile + "instancemap"
    if not config.has_section(instance_section):
        config.add_section(instance_section)

    while True:
        key = raw_input(
            'Insert the AWS EC2 instance type you wish to map: '
        )

        value = raw_input(
            'Insert the name of the instance type you wish to map this to: '
        )

        config.set(instance_section, key, value)

        add_more = raw_input(
            'Do you wish to add more mappings? (Yes/No): ')
        if add_more.lower() in ['no', 'n']:
            break

    return config