Modul postgresql cannot handle negative value when writing config files

49 views
Skip to first unread message

rbrin...@nicos-ag.com

unread,
Jul 15, 2015, 11:09:07 AM7/15/15
to puppet...@googlegroups.com
Hi,

I try to setup streaming replication using puppet. I installed the official module postgresql and I succeed writing postgresql.conf and pg_hba.conf. My problem is I cannot put negtive values in the config files although it does make sense, e.g:

example
======
...
postgresql::server::config_entry { 'max_standby_streaming_delay':  value => '-1'}
...

A value of -1 indicates to wait forever, but using the module does not allow this negative value. When it is in single quotes like above it will be in the config file as well. I did not figure out a way to obtain a plain -1 without quotes.

Any idea is appreciated.

Regards
Ralf

Hunter Haugen

unread,
Jul 15, 2015, 12:53:35 PM7/15/15
to puppet...@googlegroups.com
The provider does appear to try and handle fixnums to not be quoted https://github.com/puppetlabs/puppetlabs-postgresql/blob/master/lib/puppet/provider/postgresql_conf/parsed.rb#L20

What version of puppet is this? What errors are you getting with unquoted -1 values? `value => -1` appears to be the intended way to do this.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/d8481070-ed3d-4989-b0c9-733998432b17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rbrin...@nicos-ag.com

unread,
Jul 16, 2015, 2:36:26 AM7/16/15
to puppet...@googlegroups.com
Hi,

thanks for your feedback. I provided some more information, unfortunately the suggested quoting did not work.

installed software
##################
facter                             2.4.1-1
hiera                              1.3.4-1
puppet                             3.7.5-1
puppet-common                      3.7.5-1

scenarios
#########

1 - values in quotes
====================
postgresql::server::config_entry { 'max_standby_archive_delay':  value => '-1'}


result
------
postgresql.conf contains value in quotes:
...
max_standby_streaming_delay = '-1'
...


2 - values without quotes
=========================
postgresql::server::config_entry { 'max_standby_archive_delay':  value => -1}


result
------
puppet run fails:

Error: /Stage[main]/Main/Node[puppet02-node1]/Postgresql::Server::Config_entry[max_standby_archive_delay]/Postgresql_conf[max_standby_archive_delay]: Could not evaluate: undefined method `match' for -1:Fixnum


3 - alternative quotes
======================
postgresql::server::config_entry { 'max_standby_archive_delay':  'value => -1'}

result
------
puppet run fails:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at 'value => -1'; expected '}' at /etc/puppet/environments/production/manifests/nodes/puppet02-node1.pp:16 on node puppet02-node1
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

4 - alternative quotes2
=======================
postgresql::server::config_entry { 'max_standby_archive_delay':  `value => -1`}

result
------
puppet run fails:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Could not match `value at /etc/puppet/environments/production/manifests/nodes/puppet02-node1.pp:16 on node puppet02-node1
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run


Hunter Haugen

unread,
Jul 16, 2015, 12:53:05 PM7/16/15
to puppet...@googlegroups.com
On Wed, Jul 15, 2015 at 11:36 PM <rbrin...@nicos-ag.com> wrote:
Hi,

thanks for your feedback. I provided some more information, unfortunately the suggested quoting did not work.

Oh, I wouldn't recommend quoting numbers; just strings.
 

installed software
##################
facter                             2.4.1-1
hiera                              1.3.4-1
puppet                             3.7.5-1
puppet-common                      3.7.5-1

scenarios
#########

1 - values in quotes
====================
postgresql::server::config_entry { 'max_standby_archive_delay':  value => '-1'}


result
------
postgresql.conf contains value in quotes:
...
max_standby_streaming_delay = '-1'
...


2 - values without quotes
=========================
postgresql::server::config_entry { 'max_standby_archive_delay':  value => -1}


result
------
puppet run fails:

Error: /Stage[main]/Main/Node[puppet02-node1]/Postgresql::Server::Config_entry[max_standby_archive_delay]/Postgresql_conf[max_standby_archive_delay]: Could not evaluate: undefined method `match' for -1:Fixnum

Thanks for this. It's probably coming from this line https://github.com/puppetlabs/puppetlabs-postgresql/blob/master/lib/puppet/provider/postgresql_conf/parsed.rb#L26 but without --trace I can't be sure. Most likely that can just be moved into the conditional logic when the provider checks for Fixnum and it could work.
 


3 - alternative quotes
======================
postgresql::server::config_entry { 'max_standby_archive_delay':  'value => -1'}

result
------
puppet run fails:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at 'value => -1'; expected '}' at /etc/puppet/environments/production/manifests/nodes/puppet02-node1.pp:16 on node puppet02-node1
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

4 - alternative quotes2
=======================
postgresql::server::config_entry { 'max_standby_archive_delay':  `value => -1`}

result
------
puppet run fails:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Could not match `value at /etc/puppet/environments/production/manifests/nodes/puppet02-node1.pp:16 on node puppet02-node1
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages