Bug #731
rails changes break collections that return their own resources
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 0.24.0 | |||
| Affected Puppet version: | 0.25.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
As discussed on IRC:
- I upgraded my puppetmaster to trunk (0.23.1 r2726)
- I dumped my puppet database because I was upgrading from 0.22 and the DB schema changed
- 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
History
Updated by micah - almost 5 years ago
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
Updated by David Schmitt almost 5 years ago
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"
Updated by David Schmitt almost 5 years ago
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.
Updated by Luke Kanies almost 5 years ago
- Status changed from 1 to Closed
- 7 set to fixed
Fixed in r2746.
Updated by Valentin Vidic over 4 years ago
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]
Updated by Luke Kanies over 4 years ago
- Status changed from Closed to 4
- 7 deleted (
fixed)
Updated by David Schmitt over 4 years ago
Replying to [comment:6 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'.
Updated by David Schmitt over 4 years ago
The fix is available in the
misspiggy/fix-731branch of the repo at
git://git.black.co.at/puppet-bugfixes
Updated by Luke Kanies over 4 years ago
- Status changed from 4 to Closed
- 7 set to fixed
Patch applied by DavidS in commit:b250416c272ded3e33cdfbb7ac1de989a1b92094 and merged in commit:f775572bae39b07b21278fdff60f44620c4f4598.