[PUP-2376] Suspected bug with refresh and postgresql_psql provider Created: 2014/04/28  Updated: 2014/04/28  Resolved: 2014/04/28

Status: Closed
Project: Puppet
Component/s: Types and Providers
Affects Version/s: PUP 3.3.1
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Devan Goodwin Assignee: Kylo Ginsberg
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

RHEL 6.5 x86_64 virtual guest, kvm hypervisor



Apologies as I'm writing this with little puppet experience, but I've been working on a bug that looks like it might trace back to the puppetlabs-postgresql postgresql_psql provider.

We have a manifest with two classes like this chained with notifications:


{ 'candlepin::config': }


{ 'candlepin::database': }


(full source here: https://github.com/Katello/katello-installer/blob/master/modules/candlepin/manifests/init.pp#L88)

And in database.pp we run:

Postgresql::Server::Role[$candlepin::db_user] -> Postgresql::Server::Database[$candlepin::db_name]

On an initial run, the config class will make necessary changes triggering a refresh notification, which appears to cause the database class to both run normally, and then again as a refresh. The end result is an error creating the database user during the refresh as it already exists and was created during the normal run.

I did some debugging and in this provider:


I see command() called once, at the start before anything, it correctly applies the "unless" condition and checks to see if the role already exists, it does not, so we proceed.

I see command=() called for the normal run which creates my role.

I then see sync called here with refreshing = true: https://github.com/puppetlabs/puppetlabs-postgresql/blob/master/lib/puppet/type/postgresql_psql.rb#L13

And back in ruby.rb I then again see command=() called, however we already checked the unless condition earlier and it's not checked again, only now the role already exists, and we get an error.

This looks like something may be wrong with the tricky refreshing logic in the provider or type, if it's run with anything that might trigger both a normal run and a refresh event.

Please let me know if I can provide more info. I was hoping to submit a patch but genuinely not sure what the correct fix would be. (if this is even an issue)


Comment by Devan Goodwin [ 2014/04/28 ]

Apologies, wrong project to file under. will re-file under modules.

Generated at Sat Aug 08 07:55:05 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.