Makes flavor to be absent

    :param name: flavor name

    .. code-block:: yaml

        nova-flavor-absent:
            nova.flavor_absent:
                - name: flavor_name

def flavor_absent(name, **kwargs):
    '''
    Makes flavor to be absent

    :param name: flavor name

    .. code-block:: yaml

        nova-flavor-absent:
            nova.flavor_absent:
                - name: flavor_name
    '''
    dry_run = __opts__['test']
    ret = {'name': name, 'result': False, 'comment': '', 'changes': {}}

    try:
        object_list = __salt__['nova.flavor_list'](**kwargs)
        object_id = object_list[name]['id']
    except KeyError:
        object_id = False

    if not object_id:
        ret['result'] = True
        ret['comment'] = 'Flavor "{0}" does not exist.'.format(name)
    else:
        if dry_run:
            ret['result'] = None
            ret['comment'] = 'Flavor "{0}", id: {1}  would be deleted.'.format(name, object_id)
            ret['changes'] = {name: {'old': 'Flavor "{0}", id: {1}  exists.'.format(name, object_id),
                                     'new': ret['comment']}}
        else:
            flavor_delete = __salt__['nova.flavor_delete'](object_id, **kwargs)

            if flavor_delete:
                ret['result'] = True
                ret['comment'] = 'Flavor "{0}", id: {1}  deleted.'.format(name, object_id)
                ret['changes'] = {name: {'old': 'Flavor "{0}", id: {1}  existed.'.format(name, object_id),
                                         'new': ret['comment']}}

    return ret