Bug 1133621

Summary: Automatic provisioning ignores db password supplied in answer file
Product: Red Hat Enterprise Virtualization Manager Reporter: Petr Beňas <pbenas>
Component: ovirt-engine-setupAssignee: Simone Tiraboschi <stirabos>
Status: CLOSED CURRENTRELEASE QA Contact: Pavel Stehlik <pstehlik>
Severity: urgent Docs Contact:
Priority: high    
Version: 3.4.0CC: bazulay, didi, ecohen, eedri, gklein, iheim, lveyde, pstehlik, rbalakri, Rhev-m-bugs, sbonazzo, scohen, stirabos, yeylon
Target Milestone: ---Keywords: AutomationBlocker, ZStream
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: integration
Fixed In Version: vt3 Doc Type: Bug Fix
Doc Text:
Previously DB parameters passed to rhevm-setup using an answer file were not honored when automatic provisioning was selected. now DB parameters passed by answer file are honored also when automatic provisioning is selected
Story Points: ---
Clone Of:
: 1139211 1332892 (view as bug list) Environment:
Last Closed: 2015-02-12 14:08:57 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:
Bug Depends On:    
Bug Blocks: 1139211, 1142923, 1156165    
Attachments:
Description Flags
first answerfile
none
cleanup answerfile
none
third answerfile
none
second setup logfile none

Description Petr Beňas 2014-08-25 15:05:17 UTC
Created attachment 930569 [details]
first answerfile

Description of problem:
[ INFO  ] Stage: Misc configuration
[ INFO  ] Creating Engine database schema
[ ERROR ] Failed to execute stage 'Misc configuration': Command '/usr/share/ovirt-engine/dbscripts/create_schema.sh' failed to execute
[ INFO  ] Yum Performing yum transaction rollback
[ INFO  ] Rolling back database schema
[ INFO  ] Clearing Engine database engine
[ ERROR ] Engine database rollback failed: FATAL:  password authentication failed for user "engine" FATAL:  password authentication failed for user "engine" 

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

How reproducible:
100%, automatically and manually

Steps to Reproduce:
1. rhevm-setup --config-append=working 
2. rhevm-cleanup --config-append=cleanup 
3. rhevm-setup --config-append=setup 

Actual results:


Expected results:


Additional info:
Found by automated testing, probably introduced with av11.1

Comment 1 Petr Beňas 2014-08-25 15:05:48 UTC
Created attachment 930570 [details]
cleanup answerfile

Comment 2 Petr Beňas 2014-08-25 15:06:11 UTC
Created attachment 930571 [details]
third answerfile

Comment 3 Petr Beňas 2014-08-25 15:07:04 UTC
Created attachment 930572 [details]
second setup logfile

Comment 4 Petr Beňas 2014-08-25 15:08:03 UTC
[root@localhost ~]# tail /var/lib/pgsql/data/pg_hba.conf
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               ident
host    engine          engine          0.0.0.0/0               md5
host    engine          engine          ::0/0                   md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          ident
# IPv6 local connections:
host    all         all         ::1/128               ident

Comment 6 Petr Beňas 2014-08-25 16:26:11 UTC
Found simplier reproducing vector: 

[ INFO  ] Execution of setup completed successfully
[root@localhost ~]# export PGPASSWORD=123456; psql -d engine -U engine -h localhost -t -A -c '--'
psql: FATAL:  password authentication failed for user "engine"
[root@localhost ~]# history | tail -n 5
    5  2014-08-25 18:19:22 hostname
    6  2014-08-25 18:19:32 vim working 
    7  2014-08-25 18:19:53 rhevm-setup --config-append=working 
    8  2014-08-25 18:24:16 export PGPASSWORD=123456; psql -d engine -U engine -h localhost -t -A -c '--'
    9  2014-08-25 18:24:51 history | tail -n 5

Comment 7 David Caro 2014-08-25 17:10:40 UTC
The bug is actually that setting the postgres provisioning to true, generates the database password even if it was specified in the answerfile, changing the option:

OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:True

to

OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:False

in the first setup answerfile works as expected.

Comment 8 Petr Beňas 2014-08-26 08:07:34 UTC
I don't see any change in behaviour when trying postgresProvisioning set to False....

http://jenkins.qa.lab.tlv.redhat.com:8080/view/RhevmCore/view/3.4-All/job/3.4-git-rhevmCore-infra_tools_setup/29/console

Comment 9 Petr Beňas 2014-08-26 10:42:09 UTC
Tried manually running on freshly installed system with the OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:False
and got following result. It looks one would have to create the db manually in such case. 

 INFO  ] Creating Engine database schema
[ ERROR ] Failed to execute stage 'Misc configuration': Command '/usr/share/ovirt-engine/dbscripts/create_schema.sh' failed to execute
[ INFO  ] Yum Performing yum transaction rollback
[ INFO  ] Rolling back database schema
[ INFO  ] Clearing Engine database engine
[ ERROR ] Engine database rollback failed: could not connect to server: Connection refused      Is the server running on host "localhost" and accepting      TCP/IP connections on port 5432? could not connect to server: Connection refused     Is the server running on host "localhost" and accepting         TCP/IP connections on port 5432? 

So my guess is that if OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:True is set, the password from answerfile is ignored and new password is generated.

Comment 11 Yedidyah Bar David 2014-09-08 12:10:39 UTC
As discussed, we should also refrain from writing to the answer file the randomly-generated password.

This way, mere use of setup-generated answer file will keep the existing behavior (generate a new password), while special cases will still be able to supply their own password even if auto provisioning.

Comment 12 Eyal Edri 2014-09-10 21:29:04 UTC
bug fixed in vt3.
if you think it's not included in latest build, please contact rhev-integ

Comment 13 Petr Beňas 2014-09-11 14:58:11 UTC
in vt3

Comment 14 Yedidyah Bar David 2014-10-12 09:55:00 UTC
Simone - did you check this also on dwh/reports?

Comment 15 Simone Tiraboschi 2014-10-13 07:57:09 UTC
(In reply to Yedidyah Bar David from comment #14)
> Simone - did you check this also on dwh/reports?

Engine DB password should now be handled correctly also installing DWH and reports, didn't try what happens with DWH and reports DB password.
I'll check.

Comment 16 Yedidyah Bar David 2014-11-23 07:40:07 UTC
Perhaps take parts or all of the doctext from the 3.4 clone:

Previously, rhevm-setup with automatic provisioning ignored a database password if one was supplied in the answer file. A new random password was generated and written to the generated answer file. Now, for automatic provisioning, if a password is supplied in the answer file, it is not ignored, and the password is not written to the answer file that is generated at the end.