-
Notifications
You must be signed in to change notification settings - Fork 611
Manage postgresql_conf_path file permissions #1199
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
There are a ton of whitespace changes here, but the actual change itself is much smaller. |
Thanks alot @ekohl for your contribution. Acceptance tests are failing with the following error on ubuntu https://travis-ci.org/github/puppetlabs/puppetlabs-postgresql/jobs/737110592 |
Looks like the default file mode on Debian is 644 so I'll need to introduce a parameter for the file permission. |
c357336
to
fd08efd
Compare
I updated it and added the parameter. I only know its value for Red Hat (taken from CentOS 7 & 8) and Debian (taken from 8, 9 & 10, assuming Ubuntu is the same). |
All builds failed with
This looks like a bolt bug rather than something I did. |
@ekohl Thank you for the quick response. Looks like its using older version of bolt 2.24.1 |
fd08efd
to
113b27b
Compare
Haven't been able to quite figure out why this failed. Rebased it to get the output cleanups in to make the output a bit easier to read. |
So the problem on Debian based systems is with # ls -ld /tmp /tmp/postgresql.conf
drwxrwxrwt. 2 root root 4096 Nov 10 14:09 /tmp
-rw-------. 1 postgres postgres 0 Nov 10 14:08 /tmp/postgresql.conf
# echo test >> /tmp/postgresql.conf
bash: /tmp/postgresql.conf: Permission denied
# id
uid=0(root) gid=0(root) groups=0(root) This is probably because it's mounted as sticky. Changing the path to |
113b27b
to
a302bbb
Compare
This is really hard to debug because litmus output is really not telling me a lot. I'd guess something can't read the config file, but I can't quite figure it out. |
@ekohl Thanks alot for the quick changes. Was looking at the errors. Its failing with the folllowing error
`
By default it executes psql command from /tmp directory. We can modify the psql function to accepts one parameter to make the config path configurable. |
There is a known issue that you often end up executing it from |
manifests/server/config.pp
Outdated
ensure => file, | ||
owner => $user, | ||
group => $group, | ||
mode => '0600', |
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.
shouldn't this be using postgresql_conf_mode
?
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.
I think you may have found the thing I was struggling to find. Sometimes you're blind to your own code.
This adds a parameter (defaulting to true) to manage the postgresql_conf_path file resource. The actual content isn't managed because that's what postgresql::server::config_entry is for. However, managing the file ensures the correct permissions. It also provides a workaround for PUP-10548[1] when using Red Hat SCL for packages when the correct SELinux file context isn't present. Without managing the file, an admin will need to either make sure the package is present before running Puppet, manage the file via another module or manually set the file context after Puppet ran. With this workaround, Puppet will converge on the second run and actually start PostgreSQL. The acceptance test path is changed to avoid problems on Debian(-based) systems where the root user can't write to it. Root doens't own the file and doesn't have write access due to the sticky bit. [1]: https://tickets.puppetlabs.com/browse/PUP-10548
7a70d19
to
171a1be
Compare
Thanks to @DavidS it's green now. |
Thank you @ekohl for your contribution. |
Manage postgresql_conf_path file permissions
This adds a parameter (defaulting to true) to manage the postgresql_conf_path file resource. The actual content isn't managed because that's what postgresql::server::config_entry is for. However, managing the file ensures the correct permissions.
It also provides a workaround for PUP-10548 when using Red Hat SCL for packages when the correct SELinux file context isn't present. Without managing the file, an admin will need to either make sure the package is present before running Puppet, manage the file via another module or manually set the file context after Puppet ran. With this workaround, Puppet will converge on the second run and actually start PostgreSQL.