Project

General

Profile

Actions

Bug #9136

closed

Error uning docker plugin in Foreman 1.7.1 - create new registry

Added by Olivier Cruilles over 9 years ago. Updated over 9 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hello,

I'm trying to use the docker plugin in Foreman version 1.7.1 and it happens a bug using the 'New registry' button.

This message appears:

ActiveRecord::StatementInvalid
Mysql2::Error: Column 'id' in field list is ambiguous: SELECT id FROM `taxonomies` INNER JOIN `taxable_taxonomies` ON `taxable_taxonomies`.`taxonomy_id` = `taxonomies`.`id` WHERE `taxonomies`.`type` IN ('Location') AND `taxable_taxonomies`.`taxable_type` = 'DockerRegistry' AND `taxable_taxonomies`.`taxable_id` IS NULL ORDER BY title
app/models/concerns/taxonomix.rb:140:in `used_or_selected_location_ids'
app/views/taxonomies/_loc_org_tabs.html.erb:8:in `_app_views_taxonomies__loc_org_tabs_html_erb___2818312741173419373_93450160'
app/helpers/layout_helper.rb:268:in `form_for'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

This is the log: /var/log/foreman/production.log
Started GET "/registries/new" for 10.100.21.48 at 2015-01-27 16:32:37 -0500
Processing by RegistriesController#new as HTML
Rendered taxonomies/_loc_org_tabs.html.erb (4.8ms)
Rendered /opt/rh/ruby193/root/usr/share/gems/gems/foreman_docker-1.0.0/app/views/registries/_form.html.erb (10.8ms)
Rendered /opt/rh/ruby193/root/usr/share/gems/gems/foreman_docker-1.0.0/app/views/registries/new.html.erb within layouts/application (11.2ms)
Operation FAILED: Mysql2::Error: Column 'id' in field list is ambiguous: SELECT id FROM `taxonomies` INNER JOIN `taxable_taxonomies` ON `taxable_taxonomies`.`taxonomy_id` = `taxonomies`.`id` WHERE `taxonomies`.`type` IN ('Location') AND `taxable_taxonomies`.`taxable_type` = 'DockerRegistry' AND `taxable_taxonomies`.`taxable_id` IS NULL ORDER BY title
Rendered common/500.html.erb within layouts/application (9.4ms)
Rendered layouts/base.html.erb (2.2ms)
Completed 500 Internal Server Error in 201ms (Views: 14.1ms | ActiveRecord: 0.8ms)

Could you please help me about this problem.
Is there a problem in my database or it is a bug ?

Thank you in advance

Olivier Cruilles


Related issues 1 (0 open1 closed)

Is duplicate of Docker - Bug #9230: Errors rendering new Container and Registry pagesClosedMike McCune02/04/2015Actions
Actions #1

Updated by Dominic Cleal over 9 years ago

  • Status changed from New to Need more information

It's a bug somewhere in the activerecord/mysql2 stack, or possibly in Foreman (we can usually workaround it). I can't reproduce it here though, so I wonder if there's a package difference - could you attach the output of rpm -qa ruby193\* please?

Actions #2

Updated by Olivier Cruilles over 9 years ago

Hello,

here the list as asked:

ruby193-rubygems-1.8.24-3.el6.noarch
ruby193-rubygem-bundler_ext-0.3.0-6.el6.noarch
ruby193-rubygem-journey-1.0.4-2.el6.centos.alt.noarch
ruby193-rubygem-foreman_column_view-0.2.0-1.el6.noarch
ruby193-rubygem-mime-types-1.19-2.el6.noarch
ruby193-rubygem-launchy-2.3.0-1.el6.noarch
ruby193-rubygem-jquery-rails-2.0.2-3.el6.noarch
ruby193-rubygem-sass-rails-3.2.5-3.el6.noarch
ruby193-rubygem-flot-rails-0.0.3-3.el6.noarch
ruby193-rubygem-fog-sakuracloud-0.1.1-1.el6.noarch
ruby193-rubygem-wicked-1.1.0-1.el6.noarch
ruby193-rubygem-passenger-native-libs-4.0.18-9.6.el6.x86_64
ruby193-rubygem-minitest-2.5.1-50.el6.centos.alt.noarch
ruby193-rubygem-tzinfo-0.3.33-3.el6.noarch
ruby193-rubygem-ruby_parser-3.1.1-5.el6.noarch
ruby193-rubygem-excon-0.38.0-1.el6.noarch
ruby193-rubygem-validates_lengths_from_database-0.2.0-1.el6.noarch
ruby193-rubygem-fast_gettext-0.8.0-15.el6.noarch
ruby193-rubygem-scoped_search-2.7.1-1.el6.noarch
ruby193-rubygem-formatador-0.2.1-6.el6.noarch
ruby193-rubygem-i18n_data-0.2.7-2.el6.noarch
ruby193-rubygem-signet-0.4.5-1.el6.noarch
ruby193-rubygem-actionmailer-3.2.8-2.el6.noarch
ruby193-rubygem-builder-3.0.0-3.el6.centos.alt.noarch
ruby193-rubygem-audited-activerecord-3.0.0-2.el6.noarch
ruby193-rubygem-jquery_pwstrength_bootstrap-1.2.2-1.el6.noarch
ruby193-ruby-1.9.3.484-50.el6.centos.alt.x86_64
ruby193-rubygem-coffee-script-2.2.0-4.el6.centos.alt.noarch
ruby193-rubygem-ldap_fluff-0.3.3-1.el6.noarch
ruby193-rubygem-uglifier-1.2.6-4.el6.centos.alt.noarch
ruby193-rubygem-rack-ssl-1.3.2-8.el6.noarch
ruby193-rubygem-quiet_assets-1.0.2-6.el6.noarch
ruby193-rubygem-ipaddress-0.8.0-6.el6.noarch
ruby193-rubygem-ancestry-2.0.0-2.el6.noarch
ruby193-rubygem-railties-3.2.8-3.el6.centos.alt.noarch
ruby193-rubygem-polyglot-0.3.3-3.el6.noarch
ruby193-rubygem-spice-html5-rails-0.1.4-1.el6.noarch
ruby193-rubygem-activemodel-3.2.8-3.el6.noarch
ruby193-rubygem-mail-2.4.4-5.el6.noarch
ruby193-rubygem-extlib-0.9.16-1.el6.noarch
ruby193-rubygem-faraday-0.8.8-1.el6.noarch
ruby193-rubygem-ref-1.0.0-4.el6.noarch
ruby193-rubygem-arel-3.0.2-4.el6.noarch
ruby193-rubygem-treetop-1.4.10-6.el6.centos.alt.noarch
ruby193-rubygem-hike-1.2.1-4.el6.noarch
ruby193-rubygem-rails-3.2.8-2.el6.centos.alt.noarch
ruby193-rubygem-fog-xml-0.1.0-1.el6.noarch
ruby193-rubygem-secure_headers-1.3.3-1.el6.noarch
ruby193-rubygem-tilt-1.3.3-10.el6.centos.alt.noarch
ruby193-rubygem-foreman_dhcp_browser-0.0.6-1.el6.noarch
ruby193-rubygem-ruby2ruby-2.0.1-7.el6.noarch
ruby193-rubygem-pg-0.12.2-8.el6.x86_64
ruby193-ruby-libs-1.9.3.484-50.el6.centos.alt.x86_64
ruby193-rubygem-bigdecimal-1.1.0-50.el6.centos.alt.x86_64
ruby193-rubygem-ruby-hmac-0.4.0-8.el6.noarch
ruby193-rubygem-sprockets-2.8.2-2.el6.noarch
ruby193-rubygem-daemon_controller-1.1.4-3.el6.noarch
ruby193-rubygem-rack-test-0.6.1-3.el6.centos.alt.noarch
ruby193-rubygem-gettext_i18n_rails-0.10.0-3.el6.noarch
ruby193-rubygem-safemode-1.2.1-1.el6.noarch
ruby193-rubygem-rack-1.4.1-5.el6.centos.alt.noarch
ruby193-rubygem-oauth-0.4.7-6.el6.noarch
ruby193-rubygem-deep_cloneable-2.0.0-4.el6.noarch
ruby193-rubygem-multi_json-1.8.2-2.el6.noarch
ruby193-rubygem-jquery-ui-rails-4.1.2-1.el6.noarch
ruby193-rubygem-bundler-1.3.5-1.el6.centos.alt.noarch
ruby193-rubygem-sqlite3-1.3.6-3.el6.centos.alt.x86_64
ruby193-rubygem-eventmachine-0.12.10-9.el6.x86_64
ruby193-rubygem-daemons-1.1.4-7.el6.noarch
ruby193-rubygem-gettext-2.3.7-4.el6.noarch
ruby193-rubygem-audited-3.0.0-2.el6.noarch
ruby193-rubygem-sexp_processor-4.1.3-4.el6.noarch
ruby193-rubygem-rack-cache-1.2-3.el6.noarch
ruby193-rubygem-netrc-0.7.7-5.el6.noarch
ruby193-rubygem-diff-lcs-1.1.3-4.el6.noarch
ruby193-rubygem-deface-0.7.2-6.el6.noarch
ruby193-rubygem-uuidtools-2.1.3-3.el6.noarch
ruby193-rubygem-activerecord-3.2.8-12.el6.noarch
ruby193-rubygem-jwt-0.1.8-1.el6.noarch
ruby193-rubygem-multipart-post-1.2.0-2.el6.noarch
ruby193-rubygem-ruby-libvirt-0.5.1-1.el6.x86_64
ruby193-rubygem-sshkey-1.6.0-2.el6.noarch
ruby193-rubygem-thin-1.3.1-7.el6.x86_64
ruby193-rubygem-fog-core-1.24.0-1.el6.noarch
ruby193-rubygem-fog-1.24.0-1.el6.noarch
ruby193-rubygem-po_to_json-0.0.7-2.el6.noarch
ruby193-rubygem-rdoc-3.12-12.el6.x86_64
ruby193-rubygem-multi-select-rails-0.9.10-1.el6.noarch
ruby193-rubygem-foreman_default_hostgroup-3.0.0-1.el6.noarch
ruby193-rubygem-foreman_docker-doc-1.0.0-1.el6.noarch
ruby193-rubygem-coffee-script-source-1.3.3-4.el6.noarch
ruby193-runtime-1.1-9.el6.centos.alt.x86_64
ruby193-rubygem-rake-0.9.2.2-50.el6.centos.alt.noarch
ruby193-rubygem-will_paginate-3.0.2-7.el6.noarch
ruby193-rubygem-mysql2-0.3.11-4.el6.x86_64
ruby193-rubygem-net-ssh-2.6.7-1.el6.noarch
ruby193-ruby-wrapper-0.0.2-5.el6.noarch
ruby193-rubygem-activeresource-3.2.8-3.el6.noarch
ruby193-rubygem-unf-0.1.3-4.el6.x86_64
ruby193-rubygem-fog-softlayer-0.3.9-1.el6.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6.noarch
ruby193-facter-2.2.0-1.1.el6.x86_64
ruby193-rubygem-thor-0.18.1-2.el6.centos.alt.noarch
ruby193-rubygem-actionpack-3.2.8-13.el6.centos.alt.noarch
ruby193-rubygem-therubyracer-0.11.0-0.9.beta5.el6.centos.alt.x86_64
ruby193-rubygem-unf_ext-0.0.6-5.el6.x86_64
ruby193-rubygem-erubis-2.7.0-5.el6.noarch
ruby193-rubygem-rbovirt-0.0.29-1.el6.noarch
ruby193-rubygem-i18n-0.6.0-4.el6.noarch
ruby193-rubygem-locale-2.0.9-8.el6.noarch
ruby193-rubygem-rest-client-1.6.7-2.el6.noarch
ruby193-rubygem-levenshtein-0.2.2-2.el6.x86_64
ruby193-rubygem-rbvmomi-1.6.0-2.el6.noarch
ruby193-rubygem-addressable-2.3.5-1.el6.noarch
ruby193-rubygem-trollop-2.0-2.el6.noarch
ruby193-rubygem-google-api-client-0.6.4-1.el6.noarch
ruby193-rubygem-twitter-bootstrap-rails-2.2.6-5.el6.noarch
ruby193-rubygem-friendly_id-4.0.10.1-1.el6.noarch
ruby193-rubygem-fog-brightbox-0.0.1-1.el6.noarch
ruby193-rubygem-foreigner-1.4.2-1.el6.noarch
ruby193-ruby-irb-1.9.3.484-50.el6.centos.alt.noarch
ruby193-rubygem-io-console-0.3-50.el6.centos.alt.x86_64
ruby193-rubygem-foreman_docker-1.0.0-1.el6.noarch
ruby193-rubygem-passenger-native-4.0.18-9.6.el6.x86_64
ruby193-rubygem-execjs-1.4.0-6.el6.centos.alt.noarch
ruby193-rubygem-apipie-rails-0.2.6-1.el6.noarch
ruby193-rubygem-ffi-1.0.9-10.el6.x86_64
ruby193-rubygem-coffee-rails-3.2.2-4.el6.centos.alt.noarch
ruby193-rubygem-net-scp-1.1.0-3.el6.noarch
ruby193-rubygem-gettext_i18n_rails_js-0.0.8-2.el6.noarch
ruby193-rubygem-net-ldap-0.3.1-2.el6.noarch
ruby193-rubygem-bootstrap-sass-3.0.3.0-1.el6.noarch
ruby193-rubygem-activesupport-3.2.8-6.el6.noarch
ruby193-libyaml-0.1.4-5.1.el6.centos.alt.x86_64
ruby193-rubygem-gridster-rails-0.1.5-4.el6.noarch
ruby193-rubygem-rabl-0.9.0-1.el6.noarch
ruby193-rubygem-fog-json-1.0.0-2.el6.noarch
ruby193-rubygem-sass-3.2.13-1.el6.noarch
ruby193-rubygem-foremancli-1.0-6.el6.noarch
ruby193-rubygem-autoparse-0.3.3-1.el6.noarch
ruby193-rubygem-fog-radosgw-0.0.3-1.el6.noarch
ruby193-rubygem-docker-api-1.13.6-1.el6.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2-1.el6.noarch
ruby193-rubygem-nokogiri-1.5.11-1.el6.x86_64
ruby193-rubygem-json-1.5.5-50.el6.centos.alt.x86_64
ruby193-rubygem-foreman_reserve-0.1.8.3-2.el6.noarch
ruby193-rubygem-passenger-4.0.18-9.6.el6.x86_64
ruby193-rubygem-net-http-persistent-2.7-3.el6.centos.alt.noarch
ruby193-rubygem-archive-tar-minitar-0.5.2-9.el6.noarch

Operating System:

Centos 6.5
Foreman 1.7.1 from packages

Olivier

Actions #3

Updated by Dominic Cleal over 9 years ago

Thanks, that helped. I think what's happened is that we used to ship ruby193-rubygem-activerecord-3.2.8-12 before SCL had been released (around Foreman 1.2/1.3), then we stopped and fell back to the proper SCL builds. The official builds have a lower release (currently -8), but they have a fix for this issue.

I'd suggest running: yum downgrade ruby193-rubygem-activerecord-3.2.8-8.2.el6.centos.alt which should take you to the official CentOS build instead of our old package.

Actions #4

Updated by Olivier Cruilles over 9 years ago

I downgraded the package uby193-rubygem-activerecord but it does not fix the issue, same error

  1. rpm -qa | grep ruby193-rubygem-activerecord
    ruby193-rubygem-activerecord-3.2.8-8.2.el6.centos.alt.noarch

Started GET "/registries/new" for 10.100.21.48 at 2015-01-28 10:54:44 -0500
Processing by RegistriesController#new as HTML
Rendered taxonomies/_loc_org_tabs.html.erb (15.7ms)
Rendered /opt/rh/ruby193/root/usr/share/gems/gems/foreman_docker-1.0.0/app/views/registries/_form.html.erb (27.6ms)
Rendered /opt/rh/ruby193/root/usr/share/gems/gems/foreman_docker-1.0.0/app/views/registries/new.html.erb within layouts/application (30.5ms)
Operation FAILED: Mysql2::Error: Column 'id' in field list is ambiguous: SELECT id FROM `taxonomies` INNER JOIN `taxable_taxonomies` ON `taxable_taxonomies`.`taxonomy_id` = `taxonomies`.`id` WHERE `taxonomies`.`type` IN ('Location') AND `taxable_taxonomies`.`taxable_type` = 'DockerRegistry' AND `taxable_taxonomies`.`taxable_id` IS NULL ORDER BY title
Rendered common/500.html.erb within layouts/application (11.5ms)
Rendered layouts/base.html.erb (2.3ms)
Completed 500 Internal Server Error in 239ms (Views: 173.1ms | ActiveRecord: 2.0ms)

Olivier

Actions #5

Updated by Dominic Cleal over 9 years ago

Sorry, I forgot to add, run service httpd restart after downgrading.

Actions #6

Updated by Olivier Cruilles over 9 years ago

Sorry but I did it of course.
I restarted the service just after the downgrade.

Actions #7

Updated by Olivier Cruilles over 9 years ago

The downgrade + restart of httpd doesn't fix the issue.

I tried to update Foreman to the latest version available: 1.7.2-1 but no more result.

  1. rpm -qa | egrep "foreman|activerecord"
    ruby193-rubygem-foreman_column_view-0.2.0-1.el6.noarch
    ruby193-rubygem-activerecord-3.2.8-8.2.el6.centos.alt.noarch
    foreman-selinux-1.7.2-1.el6.noarch
    foreman-ovirt-1.7.2-1.el6.noarch
    ruby193-rubygem-audited-activerecord-3.0.0-2.el6.noarch
    foreman-libvirt-1.7.2-1.el6.noarch
    foreman-proxy-1.7.2-1.el6.noarch
    ruby193-rubygem-foreman_dhcp_browser-0.0.6-1.el6.noarch
    foreman-gce-1.7.2-1.el6.noarch
    foreman-postgresql-1.7.2-1.el6.noarch
    foreman-release-1.7.2-1.el6.noarch
    ruby193-rubygem-foreman_default_hostgroup-3.0.0-1.el6.noarch
    ruby193-rubygem-foreman_docker-doc-1.0.0-1.el6.noarch
    foreman-vmware-1.7.2-1.el6.noarch
    foreman-mysql2-1.7.2-1.el6.noarch
    ruby193-rubygem-foreman_hooks-0.3.7-2.el6.noarch
    foreman-compute-1.7.2-1.el6.noarch
    ruby193-rubygem-foreman_docker-1.0.0-1.el6.noarch
    foreman-assets-1.7.2-1.el6.noarch
    rubygem-foreman_api-0.1.11-1.el6.noarch
    ruby193-rubygem-foremancli-1.0-6.el6.noarch
    ruby193-rubygem-foreman_bootdisk-4.0.2-1.el6.noarch
    foreman-1.7.2-1.el6.noarch
    ruby193-rubygem-foreman_reserve-0.1.8.3-2.el6.noarch
    foreman-installer-1.7.2-1.el6.noarch

Olivier

Actions #8

Updated by Stephen Benjamin over 9 years ago

I can reproduce, on psql - this is a production RPM install, so maybe a difference w/ rails versions?

PGError: ERROR: column reference "id" is ambiguous LINE 1: SELECT id FROM "taxonomies" INNER JOIN "taxable_taxonomies" ... ^ : SELECT id FROM "taxonomies" INNER JOIN "taxable_taxonomies" ON "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" WHERE "taxonomies"."type" IN ('Location') AND "taxable_taxonomies"."taxable_type" = 'DockerRegistry' AND "taxable_taxonomies"."taxable_id" IS NULL ORDER BY title

Note, I also see this when creating a container, perhaps related?

Warning!
undefined method `enabled_taxonomies' for #<Class:0x00000006cae418>

Which isn't in 1.7:
https://github.com/theforeman/foreman/commit/3279c309afe2bb3581447a87448ea9e2d0e7af65

Actions #9

Updated by Olivier Cruilles over 9 years ago

Hello,

So what I can do for the moment, wait for the next update I guess.

Just for your information, I modified all the files listed by the link on git-hub (https://github.com/theforeman/foreman/commit/3279c309afe2bb3581447a87448ea9e2d0e7af65) but this did not fix the issue.

After the modifications, I done the following operations:
  • foreman-rake db:migrate
  • foreman-rake db:seed
  • service httpd restart

Did I forget something ?

Olivier

Actions #10

Updated by Dominic Cleal over 9 years ago

Could you try running this echo/foreman-rake command please and we can compare the output?

# echo "Domain.first.location_ids" | foreman-rake console
Loading production environment (Rails 3.2.8)
Switch to inspect mode.
Domain.first.location_ids
  Domain Load (0.4ms)  SELECT "domains".* FROM "domains" ORDER BY domains.name LIMIT 1
   (0.6ms)  SELECT "taxonomies".id FROM "taxonomies" INNER JOIN "taxable_taxonomies" ON "taxonomies"."id" = "taxable_taxonomies"."taxonomy_id" WHERE "taxable_taxonomies"."taxable_id" = 1 AND "taxable_taxonomies"."taxable_type" = 'Domain' AND (taxonomies.type='Location') ORDER BY title
[]

The enabled_taxonomies issue was fixed in #9177 and foreman-docker 1.0.1 (being released), but that's a different issue to this one.. which is caused by the different SCL version of Rails as you say Stephen.

Actions #11

Updated by Dominic Cleal over 9 years ago

Ah, #9230 looks very similar and has a patch. I thought the bug may have been in core Foreman, but that's a patch against foreman-docker - you could try applying that to /opt/rh/ruby193/root/usr/share/gems/gems/foreman_docker-1.0.0.

Actions #12

Updated by Olivier Cruilles over 9 years ago

Hello,
This is the result as asked:

  1. echo "Domain.first.location_ids" | foreman-rake console
    Loading production environment (Rails 3.2.8)
    Switch to inspect mode.
    Domain.first.location_ids
    Domain Load (0.3ms) SELECT `domains`.* FROM `domains` ORDER BY domains.name LIMIT 1
    (8.1ms) SELECT `taxonomies`.id FROM `taxonomies` INNER JOIN `taxable_taxonomies` ON `taxonomies`.`id` = `taxable_taxonomies`.`taxonomy_id` WHERE taxable_taxonomies`.`taxable_id` = 6 AND `taxable_taxonomies`.`taxable_type` = 'Domain' AND (taxonomies.type='Location') ORDER BY title
    [6]
Actions #13

Updated by Olivier Cruilles over 9 years ago

Hi,

After applied the patch #9230 as mentioned, the issue of taxonomies has been fixed.
So now the Registries Panel works and I can follow trying the docker plugin.

I guess this patch will be pushed in production package in a few days.

Thank you very much for your help.

Olivier

Actions #14

Updated by Dominic Cleal over 9 years ago

  • Is duplicate of Bug #9230: Errors rendering new Container and Registry pages added
Actions #15

Updated by Dominic Cleal over 9 years ago

  • Status changed from Need more information to Duplicate

I'm glad it worked, thanks for debugging with us! Hopefully there will be a 1.0.2 or similar in due course.

Actions

Also available in: Atom PDF