def _modify_config_profile()

in ec2stack/configure.py [0:0]


def _modify_config_profile(config_file, profile, advanced_network_enabled):
    """
    Modify configuration profile.

    @param config_file: current config file configuration.
    @param profile: the profile to set the attribute in.
    @return: configparser configuration.
    """
    config = SafeConfigParser()
    config.read(config_file)

    if not config.has_section(profile):
        config.add_section(profile)

    config = _set_mandatory_attributes_of_profile(config, profile)

    if advanced_network_enabled:
        config = _set_advanced_network_attributes_of_profile(config, profile)

    config = _set_optional_attributes_of_profile(config, profile)

    return config