ensure a dataset is not a clone

    name : string
        name of fileset or volume

    .. warning::

        only one dataset can be the origin,
        if you promote a clone the original will now point to the promoted dataset

def promoted(name):
    '''
    ensure a dataset is not a clone

    name : string
        name of fileset or volume

    .. warning::

        only one dataset can be the origin,
        if you promote a clone the original will now point to the promoted dataset

    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}

    ## check we if we have a valid dataset name
    if not __utils__['zfs.is_dataset'](name):
        ret['result'] = False
        ret['comment'] = 'invalid dataset name: {0}'.format(name)
        return ret

    ## ensure dataset is the primary instance
    if not __salt__['zfs.exists'](name, **{'type': 'filesystem,volume'}):
        ## NOTE: we don't have a dataset
        ret['result'] = False
        ret['comment'] = 'dataset {0} does not exist'.format(name)
    else:
        ## NOTE: check if we have a blank origin (-)
        if __salt__['zfs.get'](name, **{'properties': 'origin', 'fields': 'value', 'parsable': True})[name]['origin']['value'] == '-':
            ## NOTE: we're already promoted
            ret['comment'] = '{0} already promoted'.format(name)
        else:
            ## NOTE: promote dataset
            if not __opts__['test']:
                mod_res = __salt__['zfs.promote'](name)
            else:
                mod_res = OrderedDict([('promoted', True)])

            ret['result'] = mod_res['promoted']
            if ret['result']:
                ret['changes'][name] = 'promoted'
                ret['comment'] = '{0} promoted'.format(name)
            else:
                ret['comment'] = 'failed to promote {0}'.format(name)
                if 'error' in mod_res:
                    ret['comment'] = mod_res['error']

    return ret