Bug 1275676

Summary: Log file show: Cannot load `Rails.application.database_configuration`
Product: Red Hat CloudForms Management Engine Reporter: Thom Carlin <tcarlin>
Component: ApplianceAssignee: Nick Carboni <ncarboni>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5.0CC: abellott, jhardy, mfalesni, mfeifer, ncarboni, obarenbo, simaishi
Target Milestone: GA   
Target Release: 5.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.5.0.10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-08 13:40:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thom Carlin 2015-10-27 13:24:05 UTC
Description of problem:

Cannot load `Rails.application.database_configuration`

Version-Release number of selected component (if applicable):

5.5.0.7-beta1.3.20151021133253_ed40d96

How reproducible:

100%

Steps to Reproduce:
1. Spin up appliance
2. Examine logs
3.

Actual results:

opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/application/configuration.rb:110:in `database_configuration': Cannot load `Rails.application.database_configuration`: (RuntimeError)
Could not load database configuration. No such file - ["config/database.yml"]

Expected results:

No error

Additional info:

Evm.log excerpt:

[----] I, [2015-10-21T19:49:04.615347 #3498:ac998c]  INFO -- : MIQ(Vmdb::Loggers.apply_config) Log level for vim.log has been changed to [WARN]
/opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/application/configuration.rb:110:in `database_configuration': Cannot load `Rails.application.database_configuration`: (RuntimeError)
Could not load database configuration. No such file - ["config/database.yml"]
        from /var/www/miq/vmdb/config/environments/patches/database_configuration.rb:15:in `database_configuration'
        from /opt/rh/cfme-gemset/gems/activerecord-4.2.4/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:27:in `each'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
        from /opt/rh/cfme-gemset/gems/activerecord-4.2.4/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:226:in `block in tsort_each'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:429:in `each_strongly_connected_component_from'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:347:in `block in each_strongly_connected_component'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `call'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each_strongly_connected_component'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:224:in `tsort_each'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:203:in `tsort_each'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `public_send'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `method_missing'
        from /var/www/miq/vmdb/config/environment.rb:5:in `<top (required)>'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/application.rb:328:in `require_environment!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/runner.rb:52:in `<top (required)>'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:123:in `require'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:90:in `runner'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
        from /var/www/miq/vmdb/script/rails:6:in `require'
        from /var/www/miq/vmdb/script/rails:6:in `<main>'
[----] I, [2015-10-21T19:49:09.618887 #3514:435990]  INFO -- : MIQ(Vmdb::Loggers.apply_config) Log level for vim.log has been changed to [WARN]
/opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/application/configuration.rb:110:in `database_configuration': Cannot load `Rails.application.database_configuration`: (RuntimeError)
Could not load database configuration. No such file - ["config/database.yml"]
        from /var/www/miq/vmdb/config/environments/patches/database_configuration.rb:15:in `database_configuration'
        from /opt/rh/cfme-gemset/gems/activerecord-4.2.4/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:27:in `each'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
        from /opt/rh/cfme-gemset/gems/activerecord-4.2.4/lib/active_record/railtie.rb:116:in `block in <class:Railtie>'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:226:in `block in tsort_each'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:429:in `each_strongly_connected_component_from'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:347:in `block in each_strongly_connected_component'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `call'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:345:in `each_strongly_connected_component'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:224:in `tsort_each'
        from /opt/rh/rh-ruby22/root/usr/share/ruby/tsort.rb:203:in `tsort_each'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `public_send'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/railtie.rb:194:in `method_missing'
        from /var/www/miq/vmdb/config/environment.rb:5:in `<top (required)>'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
        from /opt/rh/cfme-gemset/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/application.rb:328:in `require_environment!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/runner.rb:52:in `<top (required)>'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:123:in `require'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:90:in `runner'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /opt/rh/cfme-gemset/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
       from /var/www/miq/vmdb/script/rails:6:in `require'
        from /var/www/miq/vmdb/script/rails:6:in `<main>'
[----] I, [2015-10-21T15:52:52.014817 #2412:122b98c]  INFO -- : MIQ(Vmdb::Loggers.apply_config) Log level for vim.log has been changed to [WARN]

Comment 2 Nick Carboni 2015-11-04 22:11:53 UTC
PR: https://github.com/ManageIQ/manageiq/pull/5290

Comment 3 CFME Bot 2015-11-04 23:19:42 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/ac69b2448fc558f36745ce9661607455a6a451e5

commit ac69b2448fc558f36745ce9661607455a6a451e5
Author:     Nick Carboni <ncarboni>
AuthorDate: Wed Nov 4 17:07:42 2015 -0500
Commit:     Nick Carboni <ncarboni>
CommitDate: Wed Nov 4 17:07:42 2015 -0500

    Prevent rails from loading database.yml before it is created
    
    The compile_sti_loader task was requiring the environment
    rake task which caused rails to attempt to parse the
    database.yml file.  This file is not present until a database
    is created.
    
    If DATABASE_URI is set rails does not look for the config,
    assuming that the user will provide the connection parameters.
    
    In this case compile_sti_loader did not need to connect to the
    database, so we fake a DATABASE_URI to stop rails from complaining.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1275676

 lib/tasks/evm.rake | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comment 5 CFME Bot 2015-11-05 21:12:31 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=e4188f33f61fc7cf57323d82e79a374c7a7cf61e

commit e4188f33f61fc7cf57323d82e79a374c7a7cf61e
Merge: 5276e9a 65d3ab2
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Thu Nov 5 16:10:00 2015 -0500
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Thu Nov 5 16:10:00 2015 -0500

    Merge branch 'backport_prevent_loading_missing_db_config' into '5.5.z'
    
    Prevent rails from loading database.yml before it is created
    
    The compile_sti_loader task was requiring the environment
    rake task which caused rails to attempt to parse the
    database.yml file.  This file is not present until a database
    is created.
    
    If DATABASE_URI is set rails does not look for the config,
    assuming that the user will provide the connection parameters.
    
    In this case compile_sti_loader did not need to connect to the
    database, so we fake a DATABASE_URI to stop rails from complaining.
    
    Clean cherry-pick from upstream master
    PR: https://github.com/ManageIQ/manageiq/pull/5290
    https://bugzilla.redhat.com/show_bug.cgi?id=1275676
    
    See merge request !362

 lib/tasks/evm.rake | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comment 6 CFME Bot 2015-11-05 21:12:37 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=65d3ab25a59905292aa3a2e9235ffb7726fd4913

commit 65d3ab25a59905292aa3a2e9235ffb7726fd4913
Author:     Nick Carboni <ncarboni>
AuthorDate: Wed Nov 4 17:07:42 2015 -0500
Commit:     Nick Carboni <ncarboni>
CommitDate: Thu Nov 5 09:00:42 2015 -0500

    Prevent rails from loading database.yml before it is created
    
    The compile_sti_loader task was requiring the environment
    rake task which caused rails to attempt to parse the
    database.yml file.  This file is not present until a database
    is created.
    
    If DATABASE_URI is set rails does not look for the config,
    assuming that the user will provide the connection parameters.
    
    In this case compile_sti_loader did not need to connect to the
    database, so we fake a DATABASE_URI to stop rails from complaining.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1275676

 lib/tasks/evm.rake | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comment 7 Milan Falešník 2015-11-19 13:37:51 UTC
Error is not present in 5.5.0.11

Comment 9 errata-xmlrpc 2015-12-08 13:40:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2015:2551