-
Notifications
You must be signed in to change notification settings - Fork 282
Allow configuration of cluster name
, locale
& encoding
#232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sample outputBased on pillar data: postgres:
version: '10'
cluster:
name: testing07
locale: en_GB.UTF-8
encoding: UTF8 Result: ID: postgresql-cluster-prepared
Function: cmd.run
Name: pg_createcluster 10 testing07 -d /var/lib/postgresql/10/testing07 --locale=en_GB.UTF-8 --encoding=UTF8
Result: True
Comment: Command "pg_createcluster 10 testing07 -d /var/lib/postgresql/10/testing07 --locale=en_GB.UTF-8 --encoding=UTF8" run
Started: 07:58:59.222295
Duration: 3380.625 ms
Changes:
----------
pid:
22103
retcode:
0
stderr:
stdout:
Creating new PostgreSQL cluster 10/testing07 ...
/usr/lib/postgresql/10/bin/initdb -D /var/lib/postgresql/10/testing07 --auth-local peer --auth-host md5 --encoding UTF8 --locale en_GB.UTF-8
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_GB.UTF-8".
The default text search configuration will be set to "english". |
|
||
#Early lookup for system user on MacOS | ||
{% if grains.os == 'MacOS' %} | ||
{% set sysuser = salt['pillar.get']('postgres.user', salt['cmd.run']("stat -f '%Su' /dev/console")) %} | ||
{% set sysgroup = salt['pillar.get']('postgres.group', salt['cmd.run']("stat -f '%Sg' /dev/console")) %} | ||
{% set sysuser = salt['pillar.get']('postgres:user', salt['cmd.run']("stat -f '%Su' /dev/console")) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch.
postgres/server/init.sls
Outdated
@@ -76,7 +76,14 @@ postgresql-cluster-prepared: | |||
- name: {{ postgres.prepare_cluster.command }} | |||
- unless: {{ postgres.prepare_cluster.test }} | |||
{%- else %} | |||
- name: {{ postgres.prepare_cluster.pgcommand }} {{ postgres.data_dir }} | |||
{%- set cc_cmd = '{0} {1}'.format(postgres.prepare_cluster.pgcommand, postgres.data_dir) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Locale is unset by default. So if value is set thats means locale pillar was set.
Could you move this Jinja logic into map.jinja
instead of init.sls
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@myii LGTM & nice overall. I have just one comment regarding placement of jinja logic before merging.
@noelmcloughlin Thanks for the review. Added another commit to move the logic to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the PR!!
You're welcome, @noelmcloughlin. Anything else required for the merge? |
@myii thanks for this, @noelmcloughlin thanks for reviewing. |
Thanks @aboe76. |
Commit: Allow configuration of cluster
name
,locale
&encoding
name
replaces literal stringmain
locale
andencoding
currently default toC
andSQL_ASCII
respectively -- obvious benefit to being able to configure these--locale=
&--encoding=
), which have identical usage in bothinitdb
andpg_createcluster
Commit: Remove trailing slash so
pkgrepo.absent
works for Aptpkgrepo.managed
so then not found bypkgrepo.absent
Commit: Fix
pillar.get
forMacOS
user/group early lookup