Project

General

Profile

Bug #12993

PostgreSQL DuplicateColumn Error

Added by Rolf Larsen about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Debian Jessie

Upgraded from 1.9.3 -> 1.10.0. Everything worked fine.

Wanted to test remote execution plugin so i did a

apt-get install ruby-smart-proxy-remote-execution-ssh && /etc/init.d/apache2 restart

Now when i try to hit my foreman i get:

Web application could not be started

PG::DuplicateColumn: ERROR:  column "version" of relation "dynflow_schema_info" already exists
 (Sequel::DatabaseError)
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `async_exec'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `block in execute_query'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/logging.rb:33:in `log_yield'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `execute_query'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `block in execute'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:143:in `check_disconnect_errors'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `execute'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:520:in `_execute'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block (2 levels) in execute'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:541:in `check_database_errors'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block in execute'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `block in synchronize'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `synchronize'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `execute'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:50:in `execute_dui'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:43:in `execute_ddl'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `block in apply_alter_table'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `each'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `apply_alter_table'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:423:in `apply_alter_table_generator'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:79:in `alter_table'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:586:in `schema_dataset'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:444:in `initialize'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:506:in `initialize'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `new'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `run'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:218:in `migrate_db'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:44:in `initialize'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/dynflow/configuration.rb:144:in `new'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/dynflow/configuration.rb:144:in `initialize_persistence'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/dynflow/configuration.rb:103:in `block in world_config'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/dynflow/configuration.rb:99:in `tap'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/dynflow/configuration.rb:99:in `world_config'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/dynflow/configuration.rb:58:in `initialize_world'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/dynflow.rb:40:in `initialize!'
  /usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.8/lib/foreman_tasks/engine.rb:100:in `block (2 levels) in <class:Engine>'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/public_api.rb:40:in `call'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/public_api.rb:40:in `block in call_event'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/public_api.rb:39:in `each'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/public_api.rb:39:in `call_event'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:348:in `before_handling_requests'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:136:in `negotiate_spawn_command'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:160:in `<module:App>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
Error ID
e3b9e24d
Application root
/usr/share/foreman
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)
production
Ruby interpreter command
/usr/bin/ruby
User and groups
uid=998(foreman) gid=998(foreman) groups=998(foreman),117(puppet)

http://debugs.theforeman.org/foreman-debug-X8odA.tar.xz


Related issues

Related to foreman-tasks - Bug #17372: Installation of foreman_tasks fails on Debian jessieDuplicate2016-11-17
Related to Packaging - Bug #20050: ruby-sequel-pg DEB pollutes Foreman ruby gem environmentClosed2017-06-19
Related to Foreman - Bug #22745: After Upgrade from 1.15.6 to 1.16.0 we can't access foremanFeedback2018-03-01
Related to Foreman Remote Execution - Bug #23061: remote execution tasks stuck in status plannedDuplicate2018-03-29

History

#1 Updated by Dominic Cleal about 6 years ago

  • Project changed from Foreman to foreman-tasks

#2 Updated by Rolf Larsen about 6 years ago

Removing ruby-smart-proxy-dynflow and ruby-smart-proxy-remote-execution-ssh gets back to normal.

#3 Updated by Rolf Larsen about 6 years ago

Broken in 1.10.1 as well.

#4 Updated by Ivan Necas about 6 years ago

I'm having issues reproducing this issue. I'm missing how `ruby-smart-proxy-dynflow` and `ruby-smart-proxy-remote-execution-ssh` could influence status you're seeing. Could you give the installer variant a try? http://theforeman.org/plugins/foreman_remote_execution/0.1/index.html#2.Installation. In case of manual installation, I would suggest trying `foreman-rake db:migrate && foreman-rake db:seed` to see, if it caused any change?

#5 Updated by Rolf Larsen about 6 years ago

root@foreman01:/usr/share/foreman-proxy# apt-get install ruby-foreman-tasks ruby-foreman-remote-execution\
>                 ruby-smart-proxy-remote-execution-ssh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ruby-foreman-tasks is already the newest version.
ruby-foreman-tasks set to manually installed.
The following extra packages will be installed:
  ruby-dynflow ruby-smart-proxy-dynflow
Suggested packages:
  doc-base
The following NEW packages will be installed:
  ruby-dynflow ruby-foreman-remote-execution ruby-smart-proxy-dynflow ruby-smart-proxy-remote-execution-ssh
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/642 kB of archives.
After this operation, 4,244 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package ruby-dynflow.
(Reading database ... 64031 files and directories currently installed.)
Preparing to unpack .../ruby-dynflow_0.8.9-1_all.deb ...
Unpacking ruby-dynflow (0.8.9-1) ...
Selecting previously unselected package ruby-smart-proxy-dynflow.
Preparing to unpack .../ruby-smart-proxy-dynflow_0.0.4-1_all.deb ...
Unpacking ruby-smart-proxy-dynflow (0.0.4-1) ...
Selecting previously unselected package ruby-smart-proxy-remote-execution-ssh.
Preparing to unpack .../ruby-smart-proxy-remote-execution-ssh_0.0.11-1_all.deb ...
Unpacking ruby-smart-proxy-remote-execution-ssh (0.0.11-1) ...
Selecting previously unselected package ruby-foreman-remote-execution.
Preparing to unpack .../ruby-foreman-remote-execution_0.1.2-1_all.deb ...
Unpacking ruby-foreman-remote-execution (0.1.2-1) ...
Setting up ruby-dynflow (0.8.9-1) ...
Setting up ruby-smart-proxy-dynflow (0.0.4-1) ...
Setting up ruby-smart-proxy-remote-execution-ssh (0.0.11-1) ...
Setting up ruby-foreman-remote-execution (0.1.2-1) ...
root@foreman01:/usr/share/foreman-proxy# foreman-rake db:migrate && foreman-rake db:seed
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
rake aborted!
Sequel::DatabaseError: PG::DuplicateColumn: ERROR:  column "version" of relation "dynflow_schema_info" already exists
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `async_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `block in execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/logging.rb:33:in `log_yield'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:143:in `check_disconnect_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:520:in `_execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block (2 levels) in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:541:in `check_database_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:50:in `execute_dui'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:43:in `execute_ddl'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `block in apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:423:in `apply_alter_table_generator'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:79:in `alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:586:in `schema_dataset'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:444:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:506:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:218:in `migrate_db'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:44:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:144:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:144:in `initialize_persistence'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:103:in `block in world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:99:in `tap'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:99:in `world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:58:in `initialize_world'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow.rb:40:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/engine.rb:122:in `block in <class:Engine>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:103:in `require_environment!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
PG::DuplicateColumn: ERROR:  column "version" of relation "dynflow_schema_info" already exists
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `async_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `block in execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/logging.rb:33:in `log_yield'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:143:in `check_disconnect_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:520:in `_execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block (2 levels) in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:541:in `check_database_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:50:in `execute_dui'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:43:in `execute_ddl'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `block in apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:423:in `apply_alter_table_generator'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:79:in `alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:586:in `schema_dataset'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:444:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:506:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:218:in `migrate_db'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:44:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:144:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:144:in `initialize_persistence'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:103:in `block in world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:99:in `tap'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:99:in `world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow/configuration.rb:58:in `initialize_world'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/dynflow.rb:40:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.10/lib/foreman_tasks/engine.rb:122:in `block in <class:Engine>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:103:in `require_environment!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

#6 Updated by Ivan Necas about 6 years ago

I'm out of ideas on what could be the reason behind this issue. It turns out the db user is able to see the dynflow_schema_info, but gets an empty set of columns on this table (instead of correctly seeing the :version column). Why could try to drop the dynflow table in psql:

drop table dynflow_steps, dynflow_actions, dynflow_coordinator_records, dynflow_delayed_plans, dynflow_envelopes, dynflow_execution_plans, dynflow_schema_info;

Running foreman-rake console should be enough for the tables to be recreated.

#7 Updated by Rolf Larsen about 6 years ago

DB drop table:

foreman_prod=# drop table dynflow_steps, dynflow_actions, dynflow_coordinator_records, dynflow_delayed_plans, dynflow_envelopes, dynflow_execution_plans, dynflow_schema_info;
DROP TABLE
foreman_prod=#

foreman-rake console:

root@foreman01:~# foreman-rake console
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
================== ds of table "dynflow_schema_info": [], checking on :version
rake aborted!
Sequel::DatabaseError: PG::DuplicateColumn: ERROR:  column "version" of relation "dynflow_schema_info" already exists
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `async_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `block in execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/logging.rb:33:in `log_yield'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:143:in `check_disconnect_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:520:in `_execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block (2 levels) in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:541:in `check_database_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:50:in `execute_dui'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:43:in `execute_ddl'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `block in apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:423:in `apply_alter_table_generator'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:79:in `alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:587:in `schema_dataset'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:444:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:506:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:218:in `migrate_db'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:44:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `initialize_persistence'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:103:in `block in world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `tap'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:58:in `initialize_world'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow.rb:40:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/engine.rb:124:in `block in <class:Engine>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:103:in `require_environment!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
PG::DuplicateColumn: ERROR:  column "version" of relation "dynflow_schema_info" already exists
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `async_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `block in execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/logging.rb:33:in `log_yield'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:143:in `check_disconnect_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:520:in `_execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block (2 levels) in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:541:in `check_database_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:50:in `execute_dui'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:43:in `execute_ddl'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `block in apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:423:in `apply_alter_table_generator'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:79:in `alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:587:in `schema_dataset'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:444:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:506:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:218:in `migrate_db'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:44:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `initialize_persistence'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:103:in `block in world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `tap'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:58:in `initialize_world'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow.rb:40:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/engine.rb:124:in `block in <class:Engine>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:103:in `require_environment!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
Tasks: TOP => console => environment
(See full trace by running task with --trace)
root@foreman01:~#

#8 Updated by Rolf Larsen about 6 years ago

Correction:

When removing ruby-foreman-salt and ruby-foreman-tasks this issue goes away.

When installing ruby-foreman-tasks it still works (migration works)

When installing ruby-foreman-salt migration breaks:

https://gist.githubusercontent.com/roflmao/fdb2ef8819c87ce4c2ce/raw/6af818e641a254b2ba26b805a8d2d386cff41450/gistfile1.txt

#9 Updated by Ivan Necas about 6 years ago

Few things to try out:

#!/bin/bash
cd /usr/share/foreman

cat <<RUBY | su - foreman -s /bin/bash -c 'bundle exec ruby'
require 'sequel'
c = Sequel.connect(:adapter => 'postgres', :username => 'foreman', :password => '****', :host => 'localhost', :database => 'foreman')

puts "count: #{ c.select.from('dynflow_schema_info').count }" 
RUBY

Another thing to try is to try creating new database on the remote server,
reconfiguing the formean teporarily to use the new database and running
`foreman-rake db:migrate && foreman-rake db:seed`

If the issue still preserves, we could try doing the same with local
database installed on the foreman server. I would like to see the results
of this to isolate the problem.

#10 Updated by Rolf Larsen about 6 years ago

root@foreman01:~# ./dynflow2.sh
count: 0

Will try the databasestuff tomorrow.

Thanks!

#11 Updated by Rolf Larsen about 6 years ago

Created new database on remote host.

Changed /etc/foreman/database.yml

Running migrate:

root@foreman01:~# foreman-rake db:migrate && foreman-rake db:seed
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
================== ds of table "dynflow_schema_info": [], checking on :version
rake aborted!
Sequel::DatabaseError: PG::DuplicateColumn: ERROR:  column "version" of relation "dynflow_schema_info" already exists
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `async_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `block in execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/logging.rb:33:in `log_yield'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:143:in `check_disconnect_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:520:in `_execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block (2 levels) in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:541:in `check_database_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:50:in `execute_dui'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:43:in `execute_ddl'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `block in apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:423:in `apply_alter_table_generator'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:79:in `alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:588:in `schema_dataset'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:444:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:506:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:218:in `migrate_db'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:44:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `initialize_persistence'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:103:in `block in world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `tap'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:58:in `initialize_world'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow.rb:40:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/engine.rb:124:in `block in <class:Engine>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:103:in `require_environment!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
PG::DuplicateColumn: ERROR:  column "version" of relation "dynflow_schema_info" already exists
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `async_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `block in execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/logging.rb:33:in `log_yield'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:180:in `execute_query'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:143:in `check_disconnect_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:167:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:520:in `_execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block (2 levels) in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:541:in `check_database_errors'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `block in execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `block in synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/connecting.rb:249:in `synchronize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/adapters/postgres.rb:336:in `execute'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:50:in `execute_dui'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/query.rb:43:in `execute_ddl'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `block in apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:418:in `apply_alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:423:in `apply_alter_table_generator'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/database/schema_methods.rb:79:in `alter_table'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:588:in `schema_dataset'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:444:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:506:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/sequel-4.26.0/lib/sequel/extensions/migration.rb:391:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:218:in `migrate_db'
/usr/share/foreman/vendor/ruby/2.1.0/gems/dynflow-0.8.9/lib/dynflow/persistence_adapters/sequel.rb:44:in `initialize'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `new'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:144:in `initialize_persistence'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:103:in `block in world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `tap'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:99:in `world_config'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow/configuration.rb:58:in `initialize_world'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/dynflow.rb:40:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/foreman-tasks-0.7.11/lib/foreman_tasks/engine.rb:124:in `block in <class:Engine>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `instance_exec'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:30:in `run'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `each'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/initializable.rb:54:in `run_initializers'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:136:in `initialize!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `block in require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:236:in `load_dependency'
/usr/share/foreman/vendor/ruby/2.1.0/gems/activesupport-3.2.21/lib/active_support/dependencies.rb:251:in `require'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:103:in `require_environment!'
/usr/share/foreman/vendor/ruby/2.1.0/gems/railties-3.2.21/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

Database contents:

foreman_prod2=# \dt+
                              List of relations
 Schema |        Name         | Type  |    Owner     |  Size   | Description 
--------+---------------------+-------+--------------+---------+-------------
 public | dynflow_schema_info | table | foreman_prod | 0 bytes | 
 public | schema_migrations   | table | foreman_prod | 0 bytes | 
(2 rows)

#12 Updated by Ivan Necas about 6 years ago

We can try a version update of the gems. Please run it as some non-admin user on the foreman server (but not the foreman user one):

mkdir ~/gemtest
cd ~/gemtest
cat <<GEMFILE > Gemfile
source 'https://rubygems.org'
gem 'sequel'
gem 'pg'
GEMFILE

bundle install

cat <<RUBY | bundle exec ruby
require 'sequel'
c = Sequel.connect(:adapter => 'postgres', :username => 'foreman', :password => '****', :host => 'localhost', :database => 'foreman')

puts "count: #{ c.select.from('dynflow_schema_info').count }" 
RUBY

you can try different variants of the `puts` as we tried before: the difference would be just having the latest sequel and pg gems.

#13 Updated by Rolf Larsen about 6 years ago

Output from run (as my own user)

Using pg 0.17.1
Using sequel 4.15.0
Using bundler 1.7.4
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
count: 0
Server version: 90115
dynflow_schema_info: []

script:

...
puts "count: #{ c.select.from('dynflow_schema_info').count }" 
puts c.fetch('select version from dynflow_schema_info limit 5;').to_a
puts "Server version: #{c.server_version}" 
info = c.select.from('dynflow_schema_info').limit(5).to_a
puts "dynflow_schema_info: #{info.inspect}" 
...

#14 Updated by Ivan Necas about 6 years ago

after more debugging we've found that the pg gem, starting with version '0.18.0' shows some incompatibilities
when running against postgres 9.1.15 server. I was not able to reproduce with postgres 9.1.15 and neither via
local or remote server.

#15 Updated by Ivan Necas about 6 years ago

  • Status changed from New to Closed

The workaround is to edit the `/usr/share/foreman/bundler.d/postgresql.rb` to `gem 'pg', '~> 0.15.0'`
and run `bundle install` in /usr/share/foreman directory (the foreman-1.11 is already pin to 0.15.x, but we've seen 0.17.1 to be ok
as well).

I'm closing it now, until we have a reproducible setup that shows the issue (without that, I can't even file a but against
the pg gem :/.

#16 Updated by Ivan Necas about 6 years ago

The postgres server version reported to not work properly with pg 0.18.x:

ii  postgresql-9.1                                         9.1.15-0+deb7u1~bpo60+1      object-relational SQL database, version 9.1 server
ii  postgresql-client-9.1                                  9.1.9-1~bpo60+1              front-end programs for PostgreSQL 9.1
ii  postgresql-client-common                               134wheezy2~bpo60+1           manager for multiple PostgreSQL client versions
ii  postgresql-common                                      134wheezy2~bpo60+1           PostgreSQL database-cluster manager
ii  postgresql-contrib-9.1                                 9.1.15-0+deb7u1~bpo60+1      additional facilities for PostgreSQL

with this configuration:

root@postgres1:~# grep -v '^$\|^\s*\#' /etc/postgresql/9.1/main/postgresql.conf
data_directory = '/var/lib/postgresql/9.1/main'        # use data in another directory
hba_file = '/etc/postgresql/9.1/main/pg_hba.conf'    # host-based authentication file
ident_file = '/etc/postgresql/9.1/main/pg_ident.conf'    # ident configuration file
external_pid_file = '/var/run/postgresql/9.1-main.pid'        # write an extra PID file
port = 5432                # (change requires restart)
unix_socket_directory = '/var/run/postgresql'        # (change requires restart)
wal_level = hot_standby
archive_mode = on
archive_command = 'cp -i %p /var/lib/postgresql/archive/%f'
max_wal_senders = 5
log_line_prefix = '%t '            # special values:
datestyle = 'iso, mdy'
lc_messages = 'en_US.UTF-8'            # locale for system error message
lc_monetary = 'en_US.UTF-8'            # locale for monetary formatting
lc_numeric = 'en_US.UTF-8'            # locale for number formatting
lc_time = 'en_US.UTF-8'                # locale for time formatting
default_text_search_config = 'pg_catalog.english'
listen_addresses = '*'
ssl = false
shared_buffers = 12GB
maintenance_work_mem = 512MB
max_connections = 1200
root@postgres1:~# 

#17 Updated by Anonymous about 4 years ago

  • Related to Bug #17372: Installation of foreman_tasks fails on Debian jessie added

#18 Updated by Anonymous about 4 years ago

  • Related to Bug #20050: ruby-sequel-pg DEB pollutes Foreman ruby gem environment added

#19 Updated by Christian Mei├čner almost 4 years ago

  • Related to Bug #22745: After Upgrade from 1.15.6 to 1.16.0 we can't access foreman added

#20 Updated by Adam Ruzicka almost 4 years ago

  • Related to Bug #23061: remote execution tasks stuck in status planned added

Also available in: Atom PDF