Bug 1572265

Summary: Diagnostics -> Region -> Database view is broken on appliance in podified environment
Product: Red Hat CloudForms Management Engine Reporter: Matouš Mojžíš <mmojzis>
Component: UI - OPSAssignee: Harpreet Kataria <hkataria>
Status: CLOSED WONTFIX QA Contact: Matouš Mojžíš <mmojzis>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.9.0CC: abellott, cpelland, hkataria, izapolsk, jrafanie, lavenel, mpovolny, ncarboni, obarenbo
Target Milestone: GA   
Target Release: cfme-future   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: ui:diagnostics
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-22 14:55:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Attachments:
Description Flags
production.log stacktrace none

Description Matouš Mojžíš 2018-04-26 14:48:26 UTC
Created attachment 1427268 [details]
production.log stacktrace

Description of problem:


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

How reproducible:
Always

Steps to Reproduce:
1. Have an appliance in podified environment
2. Go to Configuration -> Diagnostics -> Region -> Database
3.

Actual results:
Tab is empty and error in production.log

Expected results:


Additional info:

Comment 3 Joe Rafaniello 2018-04-30 19:31:31 UTC
It's blowing up in:

[----] F, [2018-04-26T13:54:51.933068 #277:82c7b0] FATAL -- : Error caught: [NoMethodError] undefined method `[]' for nil:NilClass
/opt/rh/cfme-gemset/bundler/gems/cfme-ui-classic-ac8767091e55/app/controllers/ops_controller/diagnostics.rb:836:in `database_details'

    @database_details = Rails.configuration.database_configuration[Rails.env]
    @database_display_name =
      if @database_details["host"].in?([nil, "", "localhost", "127.0.0.1"])


It's blowing up in database_details because Rails.configuration.database_configuration[Rails.env] is nil. 

database_details is called from build_backup_schedule_options_for_select.  I guess we're using environment variables in pods to find the database.  Does it even make sense to have the scheduled database backup screen for podified?

Comment 4 Nick Carboni 2018-04-30 20:07:09 UTC
>  Does it even make sense to have the scheduled database backup screen for podified?

Nope, database backup through the application won't work in podified so we shouldn't be showing any of that.

We have a convenience method to check this kind of thing. In this case we should only show the screen `unless MiqEnvironment.is_container?` [1]

Also, as a side note, we also have a method for checking if the database is running locally which would be better than redoing that logic in the controller (and would also fix this particular issue) [2]

[1] https://github.com/ManageIQ/manageiq/blob/dcd53e62d50f91c60e9814a8e1d0a483cfe57b0d/lib/miq_environment.rb#L22

[2] https://github.com/ManageIQ/manageiq/blob/dcd53e62d50f91c60e9814a8e1d0a483cfe57b0d/lib/evm_database.rb#L101