Bug #17337
openafter uninstalling remote-execution-plugin i can't create locations anymore
Added by Christian Meißner over 7 years ago. Updated about 7 years ago.
Description
Hi,
I tried remote-execution-plugin in our foreman intallation (Version 1.12). After upgrade to Version 1.13.1 I get errors going back on this plugin. Because we don't use the plugin I removed it and the upgrade finished properly. But now I have problems to create new locations.
I get the following error message in webui or hammer:
Oops, we're sorry but something went wrong The single-table inheritance mechanism failed to locate the subclass: 'JobTemplate'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Template.inheritance_column to use another column for that information.
So is there a way to fix the problem. Locations should be heavily used here, so it has a bigger business impact.
Cheers
Christian
Updated by Anonymous over 7 years ago
First, please make sure that all your instlled plugins also got updated to versions that are in the 1.13 plugin repo.
Updated by Anonymous over 7 years ago
oh, sorry.. after uninstalling. I guess that's one of the yet unsolved general plugin problems
Updated by Anonymous over 7 years ago
- Related to Bug #8272: Plugins don't cleanup after themselves during uninstallation added
Updated by Christian Meißner over 7 years ago
Michael Moll wrote:
oh, sorry.. after uninstalling. I guess that's one of the yet unsolved general plugin problems
Is there a workaround to cleanup it by hand? So we get the possibility to make locations work again in our case.
Updated by Anonymous over 7 years ago
Installing the remote_execution plugin in a recent version, doing "foreman-rake db:migrate" and "foreman-rake db:seed" should update the database, hopefully it continues to work after uninstalling the plugin again then.
Updated by Christian Meißner over 7 years ago
Michael Moll wrote:
Installing the remote_execution plugin in a recent version, doing "foreman-rake db:migrate" and "foreman-rake db:seed" should update the database, hopefully it continues to work after uninstalling the plugin again then.
I do this right now but it behaves like before. I'm unable to create new locations.
Updated by Marek Hulán over 7 years ago
Don't forget to restart the Foreman after reinstalling the rex plugin. Then it should find the JobTemplate class.
Updated by Christian Meißner over 7 years ago
Marek Hulán wrote:
Don't forget to restart the Foreman after reinstalling the rex plugin. Then it should find the JobTemplate class.
sure i restarted (in my case) the apache2 service. But it runs in an execption so, foreman isn't accessable anymore.
Updated by Marek Hulán over 7 years ago
That's weird, once the plugin is correctly installed, it should find the class just fine. How do you install the plugin?
Updated by Christian Meißner over 7 years ago
Marek Hulán wrote:
That's weird, once the plugin is correctly installed, it should find the class just fine. How do you install the plugin?
The plugin isn't installed. It was uninstalled because it prevent an update of foreman to version 1.13.1. And it is not needed in our environment.
So now we have the problem that the uninstallation left some shit there which makes some trouble. In our case we can't create locations anymore.
So the issue is that the plugin isn't cleanly uninstalled so we need to cleanup the leftover stuff.
Updated by Daniel Lobato Garcia over 7 years ago
Can you post the entire log? The easy way out here should be to install the plugin again as Marek said, however you might be able to clean up the db manually (I'd recommend just installing the plugin again to be honest). The entire log might have more clues as to what's exactly failing to load.
Updated by Christian Meißner over 7 years ago
Daniel Lobato Garcia wrote:
Can you post the entire log? The easy way out here should be to install the plugin again as Marek said, however you might be able to clean up the db manually (I'd recommend just installing the plugin again to be honest). The entire log might have more clues as to what's exactly failing to load.
After installing the remote-execution-plugin i can't bring up foreman. Hier the error.log
[ 2016-11-21 14:57:35.8284 13490/7f463c170700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 1-3] Cannot checkout session because a spawning error occurred. The identifier of the error is 9cc95db2. Please see earlier logs for details about the error. App 13657 stdout: App 13657 stdout: [ 2016-11-21 14:57:42.5220 13490/7f4642e1e700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/foreman: An error occurred while starting up the preloader. Error ID: 01d877f4 Error details saved to: /tmp/passenger-error-7qrVtW.html Message from application: JobTemplate is using attr_accessible so must either be converted to strong parameters, or add the protected_attributes gem (RuntimeError) /usr/share/foreman/config/initializers/active_record_extensions.rb:21:in `attr_accessible' /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_remote_execution-1.0.0/app/models/job_template.rb:7:in `<class:JobTemplate>' /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_remote_execution-1.0.0/app/models/job_template.rb:1:in `<top (required)>' /usr/share/foreman/vendor/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:360:in `require_or_load' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:317:in `depend_on' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:233:in `require_dependency' /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_remote_execution-1.0.0/lib/foreman_remote_execution/engine.rb:135:in `block in <class:Engine>' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:446:in `instance_exec' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:446:in `block in make_lambda' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:192:in `block in simple' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `block in call' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `call' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_prepare_callbacks' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:81:in `run_callbacks' /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!' /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application/finisher.rb:50:in `block in <module:Finisher>' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `instance_exec' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `run' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:55:in `block in run_initializers' /usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each' /usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' /usr/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child' /usr/lib/ruby/2.3.0/tsort.rb:415:in `call' /usr/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child' /usr/lib/ruby/2.3.0/tsort.rb:415:in `call' /usr/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child' /usr/lib/ruby/2.3.0/tsort.rb:415:in `call' /usr/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from' /usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component' /usr/lib/ruby/2.3.0/tsort.rb:347:in `each' /usr/lib/ruby/2.3.0/tsort.rb:347:in `call' /usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component' /usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each' /usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:54:in `run_initializers' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:352:in `initialize!' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing' /usr/share/foreman/config/environment.rb:5:in `<top (required)>' config.ru:3:in `require' config.ru:3:in `block in <main>' /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval' /usr/share/foreman/vendor/ruby/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize' config.ru:1:in `new' config.ru:1:in `<main>' /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `eval' /usr/share/passenger/helper-scripts/rack-preloader.rb:110:in `preload_app' /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `<module:App>' /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>' /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>''
foreman-rake db:migrate leads to this error:
# foreman-rake db:migrate rake aborted! JobTemplate is using attr_accessible so must either be converted to strong parameters, or add the protected_attributes gem /usr/share/foreman/config/initializers/active_record_extensions.rb:21:in `attr_accessible' /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_remote_execution-1.0.0/app/models/job_template.rb:7:in `<class:JobTemplate>' /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_remote_execution-1.0.0/app/models/job_template.rb:1:in `<top (required)>' /usr/share/foreman/vendor/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:360:in `require_or_load' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:317:in `depend_on' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:233:in `require_dependency' /usr/share/foreman/vendor/ruby/2.3.0/gems/foreman_remote_execution-1.0.0/lib/foreman_remote_execution/engine.rb:135:in `block in <class:Engine>' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:446:in `instance_exec' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:446:in `block in make_lambda' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:192:in `block in simple' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `block in call' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:504:in `call' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:778:in `_run_prepare_callbacks' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/callbacks.rb:81:in `run_callbacks' /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!' /usr/share/foreman/vendor/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application/finisher.rb:50:in `block in <module:Finisher>' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `instance_exec' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `run' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:55:in `block in run_initializers' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/initializable.rb:54:in `run_initializers' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:352:in `initialize!' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing' /usr/share/foreman/config/environment.rb:5:in `<top (required)>' /usr/share/foreman/vendor/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency' /usr/share/foreman/vendor/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:328:in `require_environment!' /usr/share/foreman/vendor/ruby/2.3.0/gems/railties-4.2.7.1/lib/rails/application.rb:457:in `block in run_tasks_blocks' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace)
Updated by Anonymous over 7 years ago
For Foreman 1.13.x you need to install foreman_remote_execution 1.2.1, not 1.0.0
Updated by Christian Meißner over 7 years ago
Michael Moll wrote:
For Foreman 1.13.x you need to install foreman_remote_execution 1.2.1, not 1.0.0
I installed from theforeman debian package repository
# Plugins compatible with Stable deb http://deb.theforeman.org/ plugins 1.13
So i thought the right version should be installed. If this is not the best way it should be mentioned i think.
What is the right way to get the correct version of plugins?
Before i upgrade to 1.13.x - via deb repo also - the remote execution version from repo works well or doesn't made any trouble. After upgrade the plugin doesn't work anymore. So I uninstall it. The problem is now not that i want use remote execution plugin, I only want to uninstall it cleanly.
So installation of an unused plugin can only be a workaround not more. So now there are two questions:
- how can I cleanly uninstall the plugin or how can I cleanup the database from any leftovers?
- how safe is it to install plugins from deb repository?
cheers
Updated by Anonymous over 7 years ago
https://deb.theforeman.org/pool/plugins/1.13/r/ruby-foreman-remote-execution/ looks correct. https://deb.theforeman.org/dists/plugins/1.13/binary-amd64/Packages also. Maybe there's something cached on your side?
Updated by Christian Meißner over 7 years ago
Michael Moll wrote:
https://deb.theforeman.org/pool/plugins/1.13/r/ruby-foreman-remote-execution/ looks correct. https://deb.theforeman.org/dists/plugins/1.13/binary-amd64/Packages also. Maybe there's something cached on your side?
Ok, there was a typo in sources.list of the given server. I switch to stable in both xenial and plugins codename an now installation of remote execution plugin works for me. But uninstall still leads to the error which is the main topic for this ticket.
For now i'll install remote execution plugin. The urgency can be set to a lower level because of the existence of this workaround.
Thanks for finding this workaround.
Updated by Christian Meißner over 7 years ago
- Priority changed from Urgent to Low
Updated by Christian Meißner over 7 years ago
Christian Meißner wrote:
Michael Moll wrote:
https://deb.theforeman.org/pool/plugins/1.13/r/ruby-foreman-remote-execution/ looks correct. https://deb.theforeman.org/dists/plugins/1.13/binary-amd64/Packages also. Maybe there's something cached on your side?
Ok, there was a typo in sources.list of the given server. I switch to stable in both xenial and plugins codename an now installation of remote execution plugin works for me. But uninstall still leads to the error which is the main topic for this ticket.
For now i'll install remote execution plugin. The urgency can be set to a lower level because of the existence of this workaround.
Thanks for finding this workaround.
May be it'll a good idea to prevent such situations by setting fixed dependencies in package dependencies.
Updated by Anonymous over 7 years ago
- Difficulty deleted (
medium)
As plugins can be potentially compatible to many Foreman versions, there can be only a lower boundary set, as plugin authors can't predict the future of the Foreman parts used and extended.
I'll leave this ticket for the r_ex Authors, but can say there are some known issues around the plugin uninstallation topic in general.
Updated by Daniel Gagnon about 7 years ago
Encountered the same issue. Was able to solve it with the following sql statement: DELETE FROM public.templates where type = 'JobTemplate';
I had to manually delete all the linked objects because I was getting this:
ERROR: update or delete on table "templates" violates foreign key constraint "templates_template_id_fk" on table "template_inputs" DETAIL: Key (id)=(291) is still referenced from table "template_inputs". ********** Error ********** ERROR: update or delete on table "templates" violates foreign key constraint "templates_template_id_fk" on table "template_inputs" SQL state: 23503 Detail: Key (id)=(291) is still referenced from table "template_inputs".