Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-2376

Suspected bug with refresh and postgresql_psql provider

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Incomplete
    • Affects Version/s: PUP 3.3.1
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
      None
    • Environment:

      RHEL 6.5 x86_64 virtual guest, kvm hypervisor

    • Template:

      Description

      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:

      class

      { 'candlepin::config': }

      ~>
      class

      { '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:

      https://github.com/puppetlabs/puppetlabs-postgresql/blob/master/lib/puppet/provider/postgresql_psql/ruby.rb

      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)

      Thanks.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                kylo Kylo Ginsberg
                Reporter:
                dgoodwin Devan Goodwin
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support