Re-enabling remote execution

I will start out with we probably screwed up somewhere on the way to here so looking for some advice.

We recently completed a migration from 1.22 to 3.3 and are going through retesting all of our work flows. When upgrading to 1.24 we hit an issue with tfm-proxy + the “hosts” page. Looking back my notes could have been better.

It started with Node.rb failing to find node after upgrade to 1.24.3 - #5 by SugoiTamago . At the time, we had tried to get remote execution working previously but had not finished (internal auth stuff) and a decision was made to just remove the plugin and get things working. This decision came from following links to Bug #27746: remove taxonomy enabled checks - Foreman Remote Execution - Foreman and Remote execution error "" 1: Failed to initialize: NoMethodError - undefined method `enabled_taxonomies' for #<Class:0x000000000a1a89c0> 2: Did you mean? enable_auditing - #3 by Felipe_Aguiar2 .

This made things happy with the installer, but had an issue with the “hosts” page presenting “The single-table inheritance mechanism failed to locate the subclass: HostStatus::ExecutionStatus”. To clean this up and keep things running we opted to run delete from host_status where type = 'HostStatus::ExecutionStatus';.

From here things went okay upgrading the rest of the way to 3.3. However we don’t delete hosts often and knowing we had to step several versions decided not to exercise all workflows until the end. This brings us to being unable to delete hosts and lines up with the issues described in Error when try to delete a host via GUI or foreman-rake console - #4 by infomatico .

So the question is how do we “recover” from this mis-step. Trying to reinstall the plugin via the installer throws issues with migrations. My quick thought is to manually review/apply migrations starting from Aug 2019 to present at which point we should be able to have the installer successfully re-install the plugin (desired end state).

Output from migrate and error on delete attached.
tfm-rex.txt.log (23.5 KB)

OS: CentOS 7.9 (started at 7.6)
TFM: 3.3.0 (started at 1.22.2)

Oh boy, what a ride. Removing plugins is rather hard to pull of right, especially if you plan on bringing them back later.

For this particular failing migration, you could safely just go into the db and delete all settings where category is Setting::RemoteExecution. They can always be re-created later.

On a more general note, what does foreman-rake db:migrate:status give you, ie. how far does foreman think it got with migrations?

Ya… it’s been a bit of an adventure and I don’t want to make it more complicated by picking the wrong option now. When I first removed the plugin to keep going I didn’t realize it didn’t roll other things back…oops.

Attached is the migrate status
migrate-status.txt.log (34.7 KB)

I should add we don’t need to preserve any past remoteexecution data/configuration.

Let’s start with just removing all the settings where category is Setting::RemoteExecution, it can’t really hurt anything right now and we’ll see where it takes us.

sigh of relief – Many thanks!!

Doing the db cleanup on the settings table allowed the installer to run, diffing the current migrate status with the one I posted shows everything as up and delete is back to working. Can get back to setting up rex fully when I get time next…haha