.. versionadded:: 2016.3.0

    Checks if postgres data directory has been initialized

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.datadir_exists '/var/lib/pgsql/data'

    name
        Name of the directory to check

def datadir_exists(name):
    '''
    .. versionadded:: 2016.3.0

    Checks if postgres data directory has been initialized

    CLI Example:

    .. code-block:: bash

        salt '*' postgres.datadir_exists '/var/lib/pgsql/data'

    name
        Name of the directory to check
    '''
    _version_file = os.path.join(name, 'PG_VERSION')
    _config_file = os.path.join(name, 'postgresql.conf')

    return os.path.isfile(_version_file) and os.path.isfile(_config_file)