def image_present(name):
    '''
    Ensure image is present on the computenode

    name : string
        uuid of image
    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    if name in __salt__['imgadm.list']():
        # we're good
        ret['result'] = True
        ret['comment'] = 'image {0} is present'.format(name)
    else:
        # add image
        available_images = __salt__['imgadm.avail']()
        if name in available_images:
            if __opts__['test']:
                ret['result'] = True
            else:
                __salt__['imgadm.import'](name)
                ret['result'] = (name in __salt__['imgadm.list']())
            ret['comment'] = 'image {0} installed'.format(name)
            ret['changes'][name] = available_images[name]
        else:
            ret['result'] = False
            ret['comment'] = 'image {0} does not exists'.format(name)

    return ret
dataset/ETHPy150Open saltstack/salt/salt/states/smartos.py/image_present/original