Puppet: System Administration Automated

Support

Ticket #731 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

rails changes break collections that return their own resources

Reported by: micah Assigned to: luke
Priority: normal Milestone: misspiggy
Component: server Version: 0.23.1
Severity: normal Keywords: puppetmaster, rails, stored configs
Cc: Triage Stage: Accepted
Attached Patches: None Complexity: Easy

Description

As discussed on IRC:

1. I upgraded my puppetmaster to trunk (0.23.1 r2726) 2. I dumped my puppet database because I was upgrading from 0.22 and the DB schema changed 3. My storedconfigs generate this error:

err: Could not retrieve configuration: Exported resource Sshkey[kakapo.my.net]

I tried to recreate the DB, same result. The export/collection manifest that I am using is here: http://pastebin.ca/628260 and it has worked before. I am confident that some other host isn't exporting that same ssh key.

When I downgraded to 0.23.0, everything worked again.

15:12 < hacim> laktop: yeah, I downgraded puppetmaster to 0.23.0 and it works again 15:12 < hacim> laktop: so something is weird in trunk 15:13 < laktop> hacim: that's what i figured, my rails stuff broke it 15:13 < laktop> yay 15:13 < laktop> so, please file that as a bug

Change History

07/20/07 23:23:06 changed by micah

  • summary changed from rails changes breaks stored configs to rails changes break collections that return their own resources.

Actually:

15:19 < laktop> stored configs work fine, but apparently you can't do a collection that returns your own resources 15:19 < laktop> that is, a host can't have a collection that would collect its own resources, only those

from others

07/27/07 22:39:14 changed by DavidS

I added debugging to puppet/parser/collect.rb:export_resource and print out 
the existing.rails_id and obj.id:
(16:55:06) DavidS|Vechta: Exported resource File[/etc/apt/apt.conf.d] cannot 
   override local resource [|39]
(16:55:22) DavidS|Vechta: where resources[id==39] is:

puppet=# select resources.id, resources.title, exported, hosts.name from resources 
   join hosts on (resources.host_id = hosts.id) 
   join source_files on (resources.source_file_id = source_files.id) 
   where resources.id in (39);

 id |        title        | exported |         name         
----+---------------------+----------+----------------------
 39 | /etc/apt/apt.conf.d |          | backuppc.black.co.at

(16:56:50) DavidS|Vechta: which, I have to add is not from the host 
   whose compilation caused the error!
(17:15:32) DavidS|Vechta: more debugging output: err: Exported resource 
   File[/etc/apt/apt.conf.d] cannot override local resource 
   [ex.id=|obj.id=205|obj.host=ejabberd.black.co.at|scope.host=fw-schmidg.edv-bus.at]

I then tried to filter in export_resources where exported.nil? , but that 
only led to collisions further down the chain:

(17:25:37) DavidS|Vechta: that didn't seem to be the point, I checked for 
   obj.exported.nil? and now i get "err: Could not retrieve configuration: 
   Duplicate definition: File[/var/lib/puppet/modules/ssmtp/ssmtp.seeds] is 
   already defined; cannot redefine at 
   /etc/puppet/modules/common/manifests/defines/config_file.pp:18"

07/29/07 11:54:43 changed by DavidS

I have fixed this problem locally by adding exported = 't' to args[:condition] in lib/puppet/parser/collector.rb:collect_exported()

AFAICT this solved the problem for me.

07/31/07 23:38:09 changed by michael

  • complexity changed from Unknown to Easy.
  • stage changed from Unreviewed to Accepted.
  • milestone set to misspiggy.

08/05/07 19:57:42 changed by luke

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [2746].

(follow-up: ↓ 8 ) 08/23/07 15:53:10 changed by vvidic

It seems exported = 't' only solves the problem for sqlite backend. MySQL uses integers for representing boolean, so something database independent should be used, for example:

        args[:conditions] = "(exported = %s AND restype = '%s')" %
            [ActiveRecord::Base.connection.quote(true), @type]

08/23/07 17:34:19 changed by luke

  • status changed from closed to reopened.
  • resolution deleted.

(in reply to: ↑ 6 ) 09/26/07 12:15:59 changed by DavidS

Replying to vvidic:

It seems exported = 't' only solves the problem for sqlite backend. MySQL uses integers for representing boolean, so something database independent should be used, for example: {{{ args[:conditions] = "(exported = %s AND restype = '%s')" % [ActiveRecord::Base.connection.quote(true), @type] }}}

I tested this on my 0.23.2 installation using postgresql and it produces the same query, i.e. with exported = 't'.

11/06/07 10:27:40 changed by DavidS

The fix is available in the misspiggy/fix-731 branch of the repo at git://git.black.co.at/puppet-bugfixes

11/08/07 23:10:30 changed by luke

  • status changed from reopened to closed.
  • resolution set to fixed.

Patch applied by DavidS in [b250416c272ded3e33cdfbb7ac1de989a1b92094] and merged in [f775572bae39b07b21278fdff60f44620c4f4598].