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

Fix postgresql_conf quote logic #297

Merged
merged 2 commits into from Apr 3, 2014

Conversation

reidmv
Copy link
Contributor

@reidmv reidmv commented Oct 26, 2013

Things like IP addresses DO need to be in quotes or PostgreSQL 9.2 won't start. Fixing regex to reflect requirement.

Can demonstrate failure pre-fix by passing an ip address in as the $listen_addresses parameter to postgresql::server.

@kbarber-jenkins2
Copy link

Can one of the admins verify this patch?

@kbarber
Copy link
Contributor

kbarber commented Oct 27, 2013

Can you add system tests for this @reidmv? I think the pattern already reflected here in the current test could be mirrored for setting an ip address: https://github.com/puppetlabs/puppetlabs-postgresql/blob/master/spec/system/server/config_entry_spec.rb

@@ -18,7 +18,7 @@
:to_line => proc { |h|

# simple string and numeric values don't need to be enclosed in quotes
dontneedquote = h[:value].match(/^(\w+|[0-9.-]+)$/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really need to be careful here, and make sure what we end up with doesn't break something else. A few more tests like shared_buffers and other simple values is wise here, but we should probably verify the quoting rules ourselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done some poking and prodding on a PostgreSQL 9.2 server with regards to quoting or not quoting data values that are strings, floating point numbers, and ip addresses. Unscientific results suggest that quoting is always acceptable, and is strictly required for values that don't match the ruby regex /\w+/.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we could change it. I think we'd want a few more tests around configuration items (using a similar pattern as we already have, perhaps even more reduced) but I think this could work. We do test this against Centos 5.9, so that gets the 8.1 coverage.

@kbarber
Copy link
Contributor

kbarber commented Nov 1, 2013

@reidmv were you going to change this default behaviour to quoting mate?

@carlio
Copy link

carlio commented Nov 18, 2013

The annoying thing is, that if there are quotes in the value, they also get added. I tried to get around this bug by doing listen_addresses => "'1.2.3.4'" and the config file ended up with ''1.2.3.4''.

@reidmv
Copy link
Contributor Author

reidmv commented Feb 21, 2014

@carlio According to the 8.1 docs and the 9.x docs, the correct way to designate a literal single quote is to issue two single quotes.

That said, I think correctly handling embedded quotes is a separate issue and outside the scope of this pull request.

@kbarber, what is needed to move this forward?

@nibalizer
Copy link

@reidmv Can you rebase this and we'll see if the tests start passing? Also, if I understand it correctly, we now need beaker tests to merge stuff into this module.

Things like IP addresses DO need to be in quotes. Fixing regex to reflect
requirement.
The test sets an ip address, uses language to indicate it should end up
in quotes.
@reidmv
Copy link
Contributor Author

reidmv commented Mar 31, 2014

@nibalizer rebased onto current master, and Travis CI looks happy. Looks like the tests that were failing were not related to this code.

apenney pushed a commit that referenced this pull request Apr 3, 2014
@apenney apenney merged commit e26036c into puppetlabs:master Apr 3, 2014
cegeka-jenkins pushed a commit to cegeka/puppet-postgresql that referenced this pull request Oct 23, 2017
…te_logic

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

Successfully merging this pull request may close these issues.

None yet

6 participants