Bug 1217818

Summary: When connecting a new appliance to an existing external database it fails
Product: Red Hat CloudForms Management Engine Reporter: Jose Simonelli <jsimonel>
Component: ApplianceAssignee: Keenan Brock <kbrock>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.4.0CC: abellott, cpelland, jhardy, jrafanie, jsimonel, kbrock, kmorey, mfalesni, obarenbo
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-16 13:01:22 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:
Attachments:
Description Flags
Error Message
none
appliance_console.log none

Description Jose Simonelli 2015-05-01 18:53:07 UTC
Created attachment 1021007 [details]
Error Message

After installing two 5.4.0.0.19 appliances, I configure one to use an internal DB. On the second appliance, I configure it to connect to the database on the first. After 
1) fetching the key
2) selecting the external db
3) join existing region
4) enter IP or hostname
5) enter database name "vmdb_production"
6) username: root
7) then the password. 

Receive "Configuration activation failed!" See attached image


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

How reproducible:
Always

Steps to Reproduce:
1. Install two 5.4.0.0.19 appliances, cfme-32-test1 and cfme-32-test2.
2. From the appliance console, configure cfme-32-test1 to use 
   an Internal DB with Region 1.
3. From the appliance console, configure cfme-32-test2 to use 
   the DB on cfme-32-test1 by providing the hostname and default
   username and pass: root/smartvm

Actual results:
The console fails to connect to the database and returns the ERROR message:
"Configuration activation failed!"

Expected results:
cfme-32-test2 successfully connects to the DB on cfme-32-test1 and displays 
a success notification in the appliance console.

Comment 2 Joe Rafaniello 2015-05-01 19:47:10 UTC
Thank you for the bug report.  Can you please provide the /var/www/miq/vmdb/log/appliance_console.log?

Comment 3 Jose Simonelli 2015-05-02 21:02:27 UTC
Created attachment 1021213 [details]
appliance_console.log

Comment 4 Jose Simonelli 2015-05-02 21:04:43 UTC
Something to note.  I configure the static IP and hostname, then I went in to connect to the external database but the log never captures any errors for that.  The only thing you can see is when it first boots and I access it where there is no database.yml file.

Comment 5 Keenan Brock 2015-05-05 03:35:04 UTC
Hi, thanks for reporting this.
Here are my notes.

Ok, this is build 20150413_095004 ( 5.4.0.0.19)
We used to have an issue loading the database.yml file, but this was resolved in [1], which should be in that build.

If you see configuration activation failed, then don't go in and boot the database, that means it failed creating the database.yml file.


What I am trying:

Verify can connect to remote machine

    service evmserverd kill
    service postgresql92-postgresql stop
    vmdb
    export EXTERNAL=192.168.118.160
    rm certificate/v2_key
    appliance_console_cli --fetch-key=$EXTERNAL --sshpassword smartvm
    rm config/database.yml
    appliance_console_cli --hostname $EXTERNAL --password smartvm
    psql -h $EXTERNAL -U root vmdb_production
    select count(*) from miq_queue
    \quit

configure remote database

    appliance_console_cli --hostname $EXTERNAL --password smartvm
    cat config/database.yml # FAIL


In appliance_console/database_configuration.rb#join_region
Tempfile.new(path) is no longer valid. adding a filename fixes this
(e.g.: Tempfile.new(['regionscr','.rb'], path) )


I will work with Joe and get this fixed on 5/5.

--kbrock



[1]: https://github.com/ManageIQ/manageiq/pull/2590

Comment 6 CFME Bot 2015-05-05 15:21:12 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/86bb87e2d40c65877f817aa1d472f1b723d2c9d4

commit 86bb87e2d40c65877f817aa1d472f1b723d2c9d4
Author:     Keenan Brock <kbrock>
AuthorDate: Mon May 4 23:39:45 2015 -0400
Commit:     Keenan Brock <kbrock>
CommitDate: Tue May 5 10:49:15 2015 -0400

    Fix appliance_console unable to join external db
    
    Apparently Temp.new(path) no longer works.
    
    This fix passes in the expected filename first, including the
    extension for good measure
    
    Temp.new([prefix, postfix], path)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1217818

 lib/appliance_console/database_configuration.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 7 Jose Simonelli 2015-05-05 16:05:49 UTC
I have made the code change provided in the git commit to my appliance and have verified this fixed the issue of adding additional appliances to the regions.

Comment 8 Milan Falešník 2015-05-12 12:45:55 UTC
Just verified it working on 5.4.0.0.26.

Comment 11 errata-xmlrpc 2015-06-16 13:01:22 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://rhn.redhat.com/errata/RHBA-2015-1100.html