Bug #933
rails warning when using export and collection of resources
| Status: | Closed | Start date: | ||
|---|---|---|---|---|
| Priority: | High | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 0.24.2 | |||
| Affected Puppet version: | 0.25.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
When resources are exported verbose output for puppet creates alot of these:
DEPRECATION WARNING: Calling .create on a has_many association without saving its owner will not work in rails 2.0, you probably want .build instead See http://www.rubyonrails.org/deprecation for details. (called from create at /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/associations/association_collection.rb:95)
doesn’t affect operation in any way though I imagine at some point it will (ruby 2.0)
History
Updated by Luke Kanies over 4 years ago
Looks like 2.0 is coming out soon, so we should fix this (if possible) before misspiggy comes out.
Updated by Bart Vanbrabant over 4 years ago
Storeconfig doesn’t work any more when rails 2.0 is used with puppet.
Updated by Bart Vanbrabant over 4 years ago
A fix for this is available in commit commit:ade9f3c7296db12eee6f3c9c3aa29b99da652960 in pending/fix-933 branch of my git repo (git://home.vanbrabant.eu/puppet)
It’s actually a one line fix. Puppet tries to add parameters and tags to a resource before it’s saved. Activerecord needs the resource to be saved before it can add ‘relations’. So in to_rails of Parser::Resource I added a call to save before those relations are added.
Updated by Luke Kanies over 4 years ago
I can’t seem to contact your git server.
Updated by Bart Vanbrabant over 4 years ago
Should work now. My git repo is hosted on a machine at home, sorry for the inconvenience.
Updated by Luke Kanies over 4 years ago
- Status changed from 1 to Closed
- 7 set to fixed
Pushed, but note that this will probably cause writing of catalogs to be much slower, which is why I was building without saving in the first place — I noticed drastic performance differences, such as reducing from 60s to 5s, when not saving each resource individually.
Updated by Bart Vanbrabant over 4 years ago
Replying to [comment:11 luke]:
Pushed, but note that this will probably cause writing of catalogs to be much slower, which is why I was building without saving in the first place — I noticed drastic performance differences, such as reducing from 60s to 5s, when not saving each resource individually.
I’ve noticed that a resource only needs to exist in the database to add relations to it. So the save should only be called when the resource hasn’t been created yet. This should reduce that overhead I think. I’ll see if I can come up with a patch for that.