Bug 1419041

Summary: db setup failure after broken pipe during setup
Product: Red Hat CloudForms Management Engine Reporter: luke couzens <lcouzens>
Component: ApplianceAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED WORKSFORME QA Contact: luke couzens <lcouzens>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.6.0CC: abellott, boyao, dajohnso, greartes, jhardy, lcouzens, obarenbo
Target Milestone: GA   
Target Release: cfme-future   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: black
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-08 15:23:44 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 luke couzens 2017-02-03 14:05:41 UTC
Description of problem:retrying appliance_console setup fails after an intial setup disconnects from broken pipe session. 


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


How reproducible:100%


Steps to Reproduce:
1.Get appliance
2.run appliance_console
3.setup db
4.close terminal during 'Initialize postgresql starting'
5.reconnect to appliance
6.run appliance_console
7.setup db again or option 4 'reset database'

Actual results: setup = Initialize postgresql failed with error - service exit code: 1.

reset db = Failed to reset database

Expected results:database configuration should setup correctly, or be recoverable.


Additional info:
appliance_console.log shows ERROR: Data directory /var/opt/rh/rh-postgresql94/lib/pgsql/data is not empty! 

and I presume for db reset failed to detect some/all DB configuration

http://pastebin.test.redhat.com/452116

A work around for this other than deploying a new appliance is if I manually clear out /var/opt/rh/rh-postgresql94/lib/pgsql/data I can then run appliance_cosole configure db again and it configures correctly.

Comment 2 Bo Yao 2017-09-27 14:03:47 UTC
Hi Luke,
I can't reproduce it in the most recent appliance console. The part you mentioned was fixed in https://bugzilla.redhat.com/show_bug.cgi?id=1426769 by Nick Carboni. In Nick's fix, if the data directory mentioned by you is not empty, appliance console will rm -rf it's content first. The same as you did manually. See:
https://github.com/ailisp/manageiq-gems-pending/blob/master/lib/gems/pending/util/postgres_admin.rb#L84

But there's still a problem: when db created successfully, but you close the terminal before database.yml created, appliance console will not allow us to create another internal db and ask us to reset first. If we reset db, it will show "Failed to reset database" and in appliance_console.log shows fail because of "database.yml doesn't exist". Should this be consider as the same BZ or create a new one? Since the error message and reason is different -- Even in your case, if you delete postgres data dir, you'll still (very likely) come to this "Failed to reset database because there's no database.yml" situation. Thank you.

Regards,
Bo

Comment 3 luke couzens 2017-09-28 08:04:58 UTC
Hi Bo,

I think this bz could be closed due to Nicks fix, and I opt for opening a new one for the database.yml if there is still another problem there.

Thanks,
Luke