[katello] error 500 when deleting katello capsule

Hi,

After deploying a katello capsule, I want to remove it again. I removed
the smart proxy but when I try to delete the host I get an "error 500"

In the foreman-ssl_error_ssl.log:

Mon Oct 24 16:20:24.016667 2016] [:error] [pid 1607] [remote
*.*.*.*:172] mod_wsgi (pid=1607): Target WSGI script
'/usr/share/pulp/wsgi/webservices.wsgi' cannot be loaded as Python
module.
[Mon Oct 24 16:20:24.016710 2016] [:error] [pid 1607] [remote
*.*.*.*:172] mod_wsgi (pid=1607): Exception occurred processing WSGI
script '/usr/share/pulp/wsgi/webservices.wsgi'.
[Mon Oct 24 16:20:24.016742 2016] [:error] [pid 1607] [remote
*.*.*.*:172] Traceback (most recent call last):
[Mon Oct 24 16:20:24.016808 2016] [:error] [pid 1607] [remote
*.*.*.*:172]   File "/usr/share/pulp/wsgi/webservices.wsgi", line
19, in <module>
[Mon Oct 24 16:20:24.017022 2016] [:error] [pid 1607] [remote
*.*.*.*:172]     application = wsgi_application()
[Mon Oct 24 16:20:24.017044 2016] [:error] [pid 1607] [remote
*.*.*.*:172]   File
"/usr/lib/python2.7/site-packages/pulp/server/webservices/application.py",
line 122, in wsgi_application
[Mon Oct 24 16:20:24.017083 2016] [:error] [pid 1607] [remote
*.*.*.*:172]     raise e
[Mon Oct 24 16:20:24.017107 2016] [:error] [pid 1607] [remote
*.*.*.*:172] ServerSelectionTimeoutError: localhost:27017: [Errno
111] Connection refused

In the foreman production.log:

2016-10-24 16:20:24 [foreman-tasks/action] [E] There was an issue
with the backend service pulp: 500 Internal Server Error (RuntimeError)
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/middleware/backend_services_check.rb:17:in
`block in plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/middleware/backend_services_check.rb:15:in
`each'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/middleware/backend_services_check.rb:15:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/middleware/remote_action.rb:9:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:34:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/middleware/keep_locale.rb:7:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:34:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/world.rb:30:in
`execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:460:in
`block (2 levels) in execute_plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`switch_flow'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:364:in
`concurrence'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:459:in
`block in execute_plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`block in with_error_handling'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`catch'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`with_error_handling'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:458:in
`execute_plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:260:in
`execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/plan_step.rb:54:in
`block in execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/abstract.rb:155:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/abstract.rb:155:in
`with_meta_calculation'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/plan_step.rb:53:in
`execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:392:in
`plan_action'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/katello/host/destroy.rb:17:in
`block in plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`switch_flow'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:364:in
`concurrence'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/katello/host/destroy.rb:13:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:461:in
`block (3 levels) in execute_plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/middleware/remote_action.rb:9:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:34:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.1.0.1/app/lib/actions/middleware/keep_locale.rb:7:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:34:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/world.rb:30:in
`execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:460:in
`block (2 levels) in execute_plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`switch_flow'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:364:in
`concurrence'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:459:in
`block in execute_plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`block in with_error_handling'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`catch'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:419:in
`with_error_handling'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:458:in
`execute_plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:260:in
`execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/plan_step.rb:54:in
`block in execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/abstract.rb:155:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/abstract.rb:155:in
`with_meta_calculation'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan/steps/plan_step.rb:53:in
`execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:191:in
`block (2 levels) in plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:281:in
`switch_flow'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:271:in
`with_planning_scope'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:190:in
`block in plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:42:in
`plan_phase'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:42:in
`plan_phase'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:42:in
`plan_phase'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware.rb:17:in
`pass'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/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:in
`block 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:in
`transaction'
  >
/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.11/lib/dynflow/transaction_adapters/active_record.rb:5:in
`transaction'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/common/transaction.rb:15:in
`rollback_on_error'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/common/transaction.rb:5:in
`plan_phase'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:22:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/world.rb:30:in
`execute'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/execution_plan.rb:189:in
`plan'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/world.rb:175:in
`block in plan_with_caller'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/world.rb:173:in
`tap'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/world.rb:173:in
`plan_with_caller'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action/with_sub_plans.rb:76:in
`block in trigger'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/world.rb:140:in
`call'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/world.rb:140:in
`trigger'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action/with_sub_plans.rb:76:in
`trigger'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.18/app/lib/actions/bulk_action.rb:51:in
`block in create_sub_plans'
  >
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in
`map'
  >
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in
`map'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.18/app/lib/actions/bulk_action.rb:50:in
`create_sub_plans'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action/with_sub_plans.rb:29:in
`initiate'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action/with_sub_plans.rb:16:in
`block in run'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matchers/abstract.rb:74:in
`block in assigns'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matchers/abstract.rb:73:in
`tap'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matchers/abstract.rb:73:in
`assigns'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:56:in
`match_value'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:36:in
`block in match?'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:35:in
`each'
  >
/opt/theforeman/tfm/root/usr/share/gems/gems/algebrick-0.7.3/lib/algebrick/matching.rb:3