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

postgresql::server::instance::reload fail on RHEL based docker containers #1572

Open
h-haaks opened this issue Feb 5, 2024 · 3 comments
Open

Comments

@h-haaks
Copy link

h-haaks commented Feb 5, 2024

Describe the Bug

The onlyif command of the Exec in Postgresql::Server::Instance::Reload failes with

Error: /Stage[main]/Postgresql::Server::Reload/Postgresql::Server::Instance::Reload[main]/Exec[postgresql_reload_main]: Failed to call refresh: invalid byte sequence in US-ASCII
Error: /Stage[main]/Postgresql::Server::Reload/Postgresql::Server::Instance::Reload[main]/Exec[postgresql_reload_main]: invalid byte sequence in US-ASCII

I have been seeing this issue in https://github.com/voxpupuli/puppet-jira acceptance test that run on quay.io/centos/centos:centos7
ie https://github.com/voxpupuli/puppet-jira/actions/runs/7570644144/job/20707054752#step:5:402

The problem seems to be the output of systemctl status which is UTF-8 encoded.

I have solved this in https://github.com/voxpupuli/puppet-jira acceptance by declaring

class { 'postgresql::server':
  service_status => 'systemctl status postgresql > /dev/null'
}

https://github.com/voxpupuli/puppet-jira/pull/414/files#diff-1379c6bd5755b4327b5570882a99637ab4538a043ddfb2ea8a3e4abdf2de3697R22

As far as I know neither Exec or Service uses the output from this command, so I wonder if the default in this modules params.pp should be changed the same way I did in https://github.com/voxpupuli/puppet-jira

@austb
Copy link

austb commented Feb 13, 2024

We hit a similar error in internal PuppetDB testing on Debian and it turned out to be because the system locale was POSIX, which changed the default encoding for Ruby as well. Setting a UTF-8 locale resolved this error.

@h-haaks
Copy link
Author

h-haaks commented Feb 13, 2024

I did try to set the locale in a few ways, but I did not succeed..
From what I experienced the service type doesn't fail the same way the exec does.
( guessing that systemctl status is used by the service type to verify if the service is running. )

If this is only affecting the exec i guess the best thing to do is to redirect the output do /dev/null for this command.
I don't see any reason why the onlyif command output should be handled by the exec.

@austb
Copy link

austb commented Feb 14, 2024

The exec is handling the onlyif command output in order to add it to the log at a debug level, so that someone can debug why their exec is or is not running. There could potentially be some improvements to the error handling around that code so that string encoding issues for debug logging doesn't cause catalog failures.

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

No branches or pull requests

3 participants