Executing dynflow action inside a transaction is not a good idea

Fresh install of Katello, 3.3 and 3.2 — server completely configured,
Unable to Register, and Delete Host.
http://debugs.theforeman.org/foreman-debug-TxbTn.tar.xz

So I'm ready for client registration, and this occurs. I'm unable to
register any host; successfully using bootstrap.py, and or cmd line
methods. Immediate error returns, with 'Executing dynflow action inside a
transaction is not a good idea'. First time I've run into this error
condition. I've installed Katello perhaps well over two dozen times, so
its not my first time out of the gate. Performing a google search on the
topic; leads to couple of previous postings dating a over a year ago. Not
much help.

This is the second occurrence on two separate fresh installations on, two
separate machines. Katello 3.2, and 3.3, pulling from current repo.

# subscription-manager register --org="ORG_NAME" 
--activationkey="HOST_ACTIVATION_KEY" --force
Executing dynflow action inside a transaction is not a good idea 

Oddly enough; somehow after many attempts to register, using both methods
( bootstrap, and cmd line ) — the host has actually shown up in Katello,
however — getting the same condition attempting to delete the host:

Actions::Katello::Host::Destroy

Input:

{"host"=>{"id"=>4, "name"=>"hostname.int.domainname.com"}}

Output:

{}

Exception:

RuntimeError: Executing dynflow action inside a transaction is not a good idea

Backtrace:

/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:145:in `ensure_not_in_transaction!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:132:in `dynflow_task_wrap'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:37:in `destroy'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/lib/actions/katello/host/destroy.rb:33:in `plan'

…snip…

Here's the attempt to register a host, and condition.

··· ------

Action:

Actions::Katello::Host::Register

Input:

{}

Output:

{}

Exception:

RuntimeError: Executing dynflow action inside a transaction is not a good idea

Backtrace:

/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:145:in ensure_not_in_transaction!' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:132:indynflow_task_wrap’
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:33:in save!' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/lib/actions/katello/host/register.rb:10:inblock in plan’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:284:in call' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:284:inswitch_flow’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:369:in sequence' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/lib/actions/katello/host/register.rb:8:inplan’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:461:in block (3 levels) in execute_plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:in pass' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:17:inpass’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/lib/actions/middleware/remote_action.rb:9:in plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:22:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:in pass' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:17:inpass’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:34:in plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:22:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:in pass' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:17:inpass’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:34:in plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:22:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/world.rb:30:in execute' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:460:inblock (2 levels) in execute_plan’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:284:in call' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:284:inswitch_flow’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:364:in concurrence' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:459:inblock in execute_plan’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:419:in call' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:419:inblock in with_error_handling’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:419:in catch' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:419:inwith_error_handling’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:458:in execute_plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/action.rb:260:inexecute’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan/steps/plan_step.rb:54:in block in execute' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan/steps/abstract.rb:155:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan/steps/abstract.rb:155:in with_meta_calculation' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan/steps/plan_step.rb:53:inexecute’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:194:in block (2 levels) in plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:284:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:284:in switch_flow' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:274:inwith_planning_scope’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:193:in block in plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:in pass' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:17:inpass’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:42:in plan_phase' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:22:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:in pass' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:17:inpass’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:42:in plan_phase' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:22:incall’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:26:in pass' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware.rb:17:inpass’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/common/transaction.rb:16:in block in rollback_on_error' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:inblock in transaction’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in within_new_transaction' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:intransaction’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in transaction' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/transaction_adapters/active_record.rb:5:intransaction’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/common/transaction.rb:15:in rollback_on_error' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/common/transaction.rb:5:inplan_phase’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/stack.rb:22:in call' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/middleware/world.rb:30:inexecute’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/execution_plan.rb:192:in plan' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/world.rb:168:inblock in plan’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/world.rb:166:in tap' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/world.rb:166:inplan’
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.15/lib/dynflow/world.rb:142:in trigger' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/lib/foreman_tasks.rb:18:intrigger’
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/lib/foreman_tasks.rb:24:in trigger_task' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/lib/foreman_tasks.rb:39:insync_task’
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/lib/foreman_tasks/triggers.rb:22:in sync_task' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb:197:inconsumer_create’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/implicit_render.rb:4:in send_action' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/base.rb:198:inprocess_action’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:10:in process_action' /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/callbacks.rb:20:inblock in process_action’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:555:in block (2 levels) in compile' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:inblock (2 levels) in around’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:inblock (2 levels) in halting’
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb:27:in repackage_message' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:inblock in make_lambda’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:inblock in halting’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:inblock in around’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in block (2 levels) in around' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in block (2 levels) in halting' /usr/share/foreman/app/controllers/api/v2/base_controller.rb:152:indisable_json_root’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:in block in make_lambda' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in block in halting' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in block in around' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:inblock (2 levels) in around’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:inblock (2 levels) in halting’
/opt/theforeman/tfm/root/usr/share/gems/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in around' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:455:inpublic_send’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:455:in block in make_lambda' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in block in halting' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in block in around' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:inblock (2 levels) in around’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:inblock (2 levels) in halting’
/usr/share/foreman/app/controllers/concerns/application_shared.rb:14:in set_timezone' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:inblock in make_lambda’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:inblock in halting’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:inblock in around’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:in block (2 levels) in around' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in block (2 levels) in halting' /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:inclear_thread’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:in block in make_lambda' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:312:in block in halting' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:497:in block in around' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:incall’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:498:inblock (2 levels) in around’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:in call' /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:313:inblock (2 levels) in halting’
/opt/theforeman/tfm/root/usr/share/gems/gems/rails-observers-0.1.2/lib/rails/observers/action_controller/caching/sweeping.rb:73:in `around’
/opt/rh/sclo-ror42/root/usr/share/gems/gems/a

Greetings all,

I solved, well ---- I found what was causing the issue. The module; *tfm-rubygem-foreman_chef
*is the problem. This is repeatable. Fresh installation; with these
two revisions; same condition.

For Katello 3.2 release; 0.4.2-1.fm1_14.el7 <---- this revision breaks
the system.
For Katello 3.3 release; 0.5.0-1.fm1_14.el7 <---- this revision breaks
the system.

Removing each latest revision and downgrading to 0.4.0-1.fm1_13.el7 will
fix the issue of *Executing dynflow action inside a transaction is not a
good idea *on Host Registration and Deletion.

# yum list tfm-rubygem-foreman_chef --showduplicates

Available Packages
tfm-rubygem-foreman_chef.noarch                                             
                                    0.4.0-1.fm1_13.el7                     
                                                            
 foreman-plugins  
tfm-rubygem-foreman_chef.noarch                                             
                                    0.4.2-1.fm1_14.el7                     
                                                            
 foreman-plugins  
tfm-rubygem-foreman_chef.noarch                                             
                                    0.5.0-1.fm1_14.el7                     
                                                            
 foreman-plugins  

# yum remove tfm-rubygem-foreman_chef
# yumdownloader tfm-rubygem-foreman_chef-0.4.0-1.fm1_13.el7 
# yum localinstall tfm-rubygem-foreman_chef-0.4.0-1.fm1_13.el7 
# foreman-installer    

Running foreman-installer rebuilds the apipie.cache; removing traces of the 
previous module

Katello 3.2 
Id: 2c40a3e6-c20b-4c86-af49-10daabbdec99
Label: Actions::Katello::Host::Register
Name: Register Host lpxxxxxxxxxxxxxxx.xxx.xxxxxxx.xxx
Owner: foreman_admin
Execution type: Delayed
Start at: 2017-02-12 05:16:51 UTC
Start before: -
Started at: 2017-02-12 05:16:51 UTC
Ended at: 2017-02-12 05:16:56 UTC
State: stopped
Result: success


Katello 3.3 
Name: Register Host coruscant.xxxxxx.xxx
Result:  success
Triggered by: xxxxxxx
Execution type: Immediate
Start at: about 9 hours ago
Started at: about 9 hours ago
Ended at: about 9 hours ago
Start before: -
··· On Sunday, February 12, 2017 at 6:42:45 AM UTC-5, Daniel Pratt wrote: > > > Fresh install of Katello, 3.3 and 3.2 --- server completely configured, > Unable to Register, and Delete Host. > > Actions::Katello::Host::Destroy > > Exception: > > RuntimeError: Executing dynflow action inside a transaction is not a good idea > > Backtrace: > > /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:145:in `ensure_not_in_transaction!' > /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:132:in `dynflow_task_wrap' > /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:37:in `destroy' > /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/lib/actions/katello/host/destroy.rb:33:in `plan' > ......snip....... > > > > Here's the attempt to register a host, and condition. > > ------ > > Action: > > Actions::Katello::Host::Register > > Exception: > > RuntimeError: Executing dynflow action inside a transaction is not a good idea > > Backtrace: > > /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:145:in `ensure_not_in_transaction!' > /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:132:in `dynflow_task_wrap' > /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.8.2/app/models/foreman_tasks/concerns/action_triggering.rb:33:in `save!' > /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.2.1.1/app/lib/actions/katello/host/register.rb:10:in `block in plan' > ..... snip......... > >

For anyone who hits this but isn’t on the same versions as the parent, this same solution worked for me. Running foreman 1.16, katello 3.5, and was running tfm-rubygem-foreman_chef 0.6, but ended up removing it. Possibly downgrading it as OP did could work.