def image_vacuum(name):
    '''
    Delete images not in use or installed via image_present
    '''
    name = name.lower()
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    # list of images to keep
    images = []

    # retreive image_present state data for host
    for state in __salt__['state.show_lowstate']():
        # don't throw exceptions when not highstate run
        if state not in 'state':
            continue

        # skip if not from this state module
        if state['state'] != __virtualname__:
            continue
        # skip if not image_present
        if state['fun'] not in ['image_present']:
            continue
        # keep images installed via image_present
        if 'name' in state:
            images.append(state['name'])

    # retrieve images in use by vms
    for image_uuid in __salt__['vmadm.list'](order='image_uuid'):
        if image_uuid in images:
            continue
        images.append(image_uuid)

    # purge unused images
    ret['result'] = True
    for image_uuid in __salt__['imgadm.list']():
        if image_uuid in images:
            continue
        if image_uuid in __salt__['imgadm.delete'](image_uuid):
            ret['changes'][image_uuid] = None
        else:
            ret['result'] = False
            ret['comment'] = 'failed to delete images'

    if ret['result'] and len(ret['changes']) == 0:
        ret['comment'] = 'no images deleted'
    elif ret['result'] and len(ret['changes']) > 0:
        ret['comment'] = 'images deleted'

    return ret
dataset/ETHPy150Open saltstack/salt/salt/states/smartos.py/image_vacuum/swapped operands of `not in`