Skip to content
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

Fails due to incorrect locale #110

Closed
goetzk opened this issue Nov 18, 2015 · 5 comments
Closed

Fails due to incorrect locale #110

goetzk opened this issue Nov 18, 2015 · 5 comments

Comments

@goetzk
Copy link

goetzk commented Nov 18, 2015

Hi,
My DB is failing to start due to some invalid configuration entries

root@review:~# /etc/init.d/postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
   Active: active (exited) since Wed 2015-11-18 18:23:47 AEDT; 6min ago
  Process: 3629 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 3629 (code=exited, status=0/SUCCESS)
root@review:~# tail /var/log/postgresql/postgresql-9.4-main.log 
2015-11-18 07:23:28 UTC LOG:  invalid value for parameter "lc_messages": "en_US.UTF-8"
2015-11-18 07:23:28 UTC LOG:  invalid value for parameter "lc_monetary": "en_US.UTF-8"
2015-11-18 07:23:28 UTC LOG:  invalid value for parameter "lc_numeric": "en_US.UTF-8"
2015-11-18 07:23:28 UTC LOG:  invalid value for parameter "lc_time": "en_US.UTF-8"
2015-11-18 07:23:28 UTC FATAL:  configuration file "/etc/postgresql/9.4/main/postgresql.conf" contains errors
2015-11-18 07:23:46 UTC LOG:  invalid value for parameter "lc_messages": "en_US.UTF-8"
2015-11-18 07:23:46 UTC LOG:  invalid value for parameter "lc_monetary": "en_US.UTF-8"
2015-11-18 07:23:46 UTC LOG:  invalid value for parameter "lc_numeric": "en_US.UTF-8"
2015-11-18 07:23:46 UTC LOG:  invalid value for parameter "lc_time": "en_US.UTF-8"
2015-11-18 07:23:46 UTC FATAL:  configuration file "/etc/postgresql/9.4/main/postgresql.conf" contains errors    
root@review:~# locale
LANG=en_AU.UTF-8
LANGUAGE=en_AU:en
LC_CTYPE="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_PAPER="en_AU.UTF-8"
LC_NAME="en_AU.UTF-8"
LC_ADDRESS="en_AU.UTF-8"
LC_TELEPHONE="en_AU.UTF-8"
LC_MEASUREMENT="en_AU.UTF-8"
LC_IDENTIFICATION="en_AU.UTF-8"
LC_ALL=

Seems this is due to the system locale differing from the strings being complained about (I have postgresql_locale: 'en_AU.UTF-8' set).

I think the best solution would be to the relevant lc_* entries so they default to postgresql_locale if not set specifically.
I believe http://docs.ansible.com/ansible/playbooks_filters.html#defaulting-undefined-variables is the relevant part of the docs.

@farridav
Copy link

I'm going to try and get a travis run using your locale and see if I can get a failing test case...

...The tests are passing, though this may be because Ive not got the right setup in travis... will tweak it a little to try and get a failure condition

@farridav
Copy link

do you have en_AU.UTF-8 UTF-8 in your /var/lib/locales/supported.d/local?

@goetzk
Copy link
Author

goetzk commented Nov 18, 2015

Yes I have postgresql_locale: 'en_AU.UTF-8' set in my playbook but didn't have postgresql_lc_* set. They defaulted to en_US.UTF-8. Having changed them explicitly the failing step is working.

postgresql_version: 9.4
postgresql_encoding: 'UTF-8'
postgresql_locale: 'en_AU.UTF-8'
# These lc_* need to be set too, bug filed upstream https://github.com/ANXS/postgresql/issues/110
postgresql_lc_messages: 'en_AU.UTF-8'
postgresql_lc_monetary: 'en_AU.UTF-8'
postgresql_lc_numeric: 'en_AU.UTF-8'
postgresql_lc_time: 'en_AU.UTF-8'

I don't seem to have a /var/lib/locales/supported.d/local file, infact /var/lib/locales doesn't exist on this system.

review:~# ls -lhd /var/lib/locales
ls: cannot access /var/lib/locales: No such file or directory

review:~# apt-cache policy locales
locales:
  Installed: 2.19-18+deb8u1
  Candidate: 2.19-18+deb8u1
  Version table:
 *** 2.19-18+deb8u1 0
        500 http://ftp.iinet.net.au/debian/debian/ jessie/main amd64 Packages
        100 /var/lib/dpkg/status

@farridav
Copy link

Are you happy to close this issue? I have added a section to the README to make it clear on how to change locale.. see #112 ..

update: changed the focus of the change to make local changing easier by setting postgresql_lc_* to the value of postgresql_locale

@goetzk
Copy link
Author

goetzk commented Nov 19, 2015

After reading #112 I'm happy for this to be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants