def present(version,
            name,
            port=None,
            encoding=None,
            locale=None,
            datadir=None):
    msg = 'Cluster {0}/{1} is already present'.format(version, name)
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': msg}

    if __salt__['postgres.cluster_exists'](version, name):
        # check cluster config is correct
        infos = __salt__['postgres.cluster_list'](verbose=True)
        info = infos['{0}/{1}'.format(version, name)]
        # TODO: check locale en encoding configs also
        if any((port != info['port'] if port else False,
                datadir != info['datadir'] if datadir else False,)):
            ret['comment'] = 'Cluster {0}/{1} has wrong parameters ' \
                             'which couldn\'t be changed on fly.' \
                                 .format(version, name)
            ret['result'] = False
        return ret

    # The cluster is not present, add it!
    if __opts__.get('test'):
        ret['result'] = None
        msg = 'Cluster {0}/{1} is set to be created'
        ret['comment'] = msg.format(version, name)
        return ret
    cluster = __salt__['postgres.cluster_create'](
        version=version,
        name=name,
        port=port,
        locale=locale,
        encoding=encoding,
        datadir=datadir)
    if cluster:
        msg = 'The cluster {0}/{1} has been created'
        ret['comment'] = msg.format(version, name)
        ret['changes']['{0}/{1}'.format(version, name)] = 'Present'
    else:
        msg = 'Failed to create cluster {0}/{1}'
        ret['comment'] = msg.format(version, name)
        ret['result'] = False
    return ret
Safe defaults for model-global names in case module is disabled
dataset/ETHPy150Open saltstack/salt/salt/states/postgres_cluster.py/present--crossover with--dataset/ETHPy150Open sahana/eden/modules/s3db/irs.py/S3IRSModel.defaults