Repository navigation
fix: restart PostgreSQL as soon as new locales are generated - #33
Merged
Merged
Conversation
Installing the packages starts the server, which only sees locales generated afterwards once it restarts. That restart was a handler, so it waited for the end of the play, and any later role creating a database in the new locale failed with invalid locale name. Restart right after generating them instead, and only when something was generated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Written with Claude Opus 5.5
Fixes #29.
Change
In
roles/postgresql/tasks/setup-Debian.yml, installing the packages starts the server, and the locales inpostgresql_localesare generated after that. The server only sees new locales once it restarts. That restart was a handler, so it waited for the end of the play, and any later role that created a database in the new locale failed:The role keeps the existing
Restart postgresqlhandler, and now runsmeta: flush_handlersright after generating the locales. The server therefore restarts straight away, and only when a locale was actually generated. A separate restart task conditioned on the locale result would fail ansible-lint'sno-handlerrule.Testing
On a Debian 12 EC2 instance from the stock AMI, which only has
C.UTF-8:en_US.UTF-8in the same play failed with the error above.CREATE DATABASE … LC_COLLATE 'en_US.UTF-8'failing. A rerun then generated the locale, the restart ran, and every database was created.flush_handlersversion runs the same restart at the same point in the play, but hasn't been rerun on EC2.prettier --check,yamllintandansible-lint(production profile,postgresqlrole) pass.