Bug #11037
closedPuppet class importer crashes with ruby stack trace trying to import an environment named: new
Description
I have Foreman 1.8.2 installed on a RHEL6 server and am using OS Puppet 3.8.1. If I have a Puppet directory environment named "new" and try to run the foreman puppet:import:puppet_classes rake task, then it crashes with the following ruby stack trace:
2015-07-07 11:42:39 [W] Failed to refresh puppet classes: Validation failed: Friendly is reserved
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:56:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `block in save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:246:in `save!'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/validations.rb:41:in `create!'
/usr/share/foreman/app/services/puppet_class_importer.rb:272:in `find_or_create_env'
/usr/share/foreman/app/services/puppet_class_importer.rb:192:in `add_classes_to_foreman'
/usr/share/foreman/app/services/puppet_class_importer.rb:59:in `block in obsolete_and_new'
/usr/share/foreman/app/services/puppet_class_importer.rb:57:in `each'
/usr/share/foreman/app/services/puppet_class_importer.rb:57:in `obsolete_and_new'
/usr/share/foreman/lib/tasks/puppet.rake:127:in `block (3 levels) in <top (required)>'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `call'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `block in execute'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `each'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `execute'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:158:in `block in invoke_with_call_chain'
/opt/rh/ruby193/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:151:in `invoke_with_call_chain'
/opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:144:in `invoke'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:116:in `invoke_task'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block (2 levels) in top_level'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `each'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block in top_level'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:88:in `top_level'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:66:in `block in run'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling'
/opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in `run'
/opt/rh/ruby193/root/usr/bin/rake:32:in `<main>'
Updated by Dominic Cleal over 9 years ago
- Category set to Puppet integration
- Difficulty set to easy
Looks like friendly_id, I guess because /new would be a valid route and shouldn't be the name of an environment.
Probably just changing Parameterizable::ByName to ByIdName in the Environment model would be sufficient.
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2710 added
- Pull request deleted (
)
Updated by Dominic Cleal over 9 years ago
- Assignee set to Shlomi Zadok
- Translation missing: en.field_release set to 88
Updated by Shlomi Zadok over 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 8387eb79d86947a63b3856c5ce64936f39c2a9a0.
Updated by Dominic Cleal about 9 years ago
- Related to Bug #11999: Foreman Puppet Class Import for Specific Environment Failing Due to Malformed Environment Name in API Query added
Updated by Dominic Cleal about 9 years ago
- Related to Bug #12004: API: cannot query environments by name added