Updates ret iff there was a failure or in test mode.

def _update_global_secondary_indexes(ret, changes_old, changes_new, comments, existing_index_names,
                                     provisioned_gsi_config, gsi_config, name, region, key,
                                     keyid, profile):
    '''Updates ret iff there was a failure or in test mode.'''
    try:
        provisioned_throughputs, index_updates = _determine_gsi_updates(
            existing_index_names, provisioned_gsi_config, gsi_config)
    except GsiNotUpdatableError as e:
        ret['result'] = False
        ret['comment'] = six.text_type(e)
        return

    if index_updates:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'Dynamo table {0} will have GSIs updated: {1}'.format(
                name, ', '.join(index_updates.keys()))
            return
        changes_old.setdefault('global_indexes', {})
        changes_new.setdefault('global_indexes', {})
        success = __salt__['boto_dynamodb.update_global_secondary_index'](
            name,
            index_updates,
            region=region,
            key=key,
            keyid=keyid,
            profile=profile,
        )

        if success:
            comments.append(
                'Updated GSIs with new throughputs {0}'.format(index_updates))
            for index_name in index_updates:
                changes_old['global_indexes'][index_name] = provisioned_throughputs[index_name]
                changes_new['global_indexes'][index_name] = index_updates[index_name]
        else:
            ret['result'] = False
            ret['comment'] = 'Failed to update GSI throughputs {0}'.format(index_updates)