def _read_user_resource_type_mappings()

in ec2stack/configure.py [0:0]


def _read_user_resource_type_mappings(config, profile):
    """
    Add resource type mappings to profile.

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

    while True:
        key = raw_input(
            'Insert the cloudstack resource id you wish to map: '
        )

        value = raw_input(
            'Insert the cloudstack resource type you wish to map this to: '
        )

        config.set(resource_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