Bug 1529489 - engine-cleanup fails if history database is inaccessible
Summary: engine-cleanup fails if history database is inaccessible
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-dwh
Classification: oVirt
Component: Setup
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.2.2
: 4.2.2
Assignee: Yedidyah Bar David
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks: 1631202
TreeView+ depends on / blocked
 
Reported: 2017-12-28 11:07 UTC by Yedidyah Bar David
Modified: 2018-12-10 09:24 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Even if the dwh database is inaccessible, engine-cleanup can now finish successfully - but without clearing the database, obviously.
Clone Of:
Environment:
Last Closed: 2018-03-29 11:13:27 UTC
oVirt Team: Integration
Embargoed:
rule-engine: ovirt-4.2+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 87241 0 'None' MERGED packaging: setup: Create pgpass only if password is not None 2021-02-11 18:02:14 UTC

Description Yedidyah Bar David 2017-12-28 11:07:48 UTC
Description of problem:

If the dwh database is inaccessible, e.g. because the credentials were changed or because it's down/corrupted/etc., engine-cleanup fails.

It emits:

[WARNING] Cannot connect to DWH database using existing credentials: ovirt_engine_history@localhost:5432

And then:

[ ERROR ] Failed to execute stage 'Misc configuration': 'NoneType' object is not iterable

setup log has:

2017-12-28 12:54:39,743+0200 DEBUG otopi.context context._executeMethod:128 Stage misc METHOD otopi.plugins.ovirt_engine_common.ovirt_engine_dwh.db.pgpass.Plugin._misc
2017-12-28 12:54:39,744+0200 DEBUG otopi.context context._executeMethod:143 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 133, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-common/ovirt-engine-dwh/db/pgpass.py", line 57, in _misc
    dbenvkeys=odwhcons.Const.DWH_DB_ENV_KEYS,
  File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine_common/database.py", line 357, in createPgPass
    ':\\',
  File "/usr/lib/python2.7/site-packages/ovirt_engine/util.py", line 45, in escape
    for c in s:
TypeError: 'NoneType' object is not iterable

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

Current master, probably much before

How reproducible:
Always

Steps to Reproduce:
1. engine-setup, configure dwh
2. Change dwh db password
3. engine-cleanup

Actual results:
Fails as above

Expected results:
Succeeds

Additional info:

engine-cleanup deliberately has a code to emit the above warning instead of failing (which is what engine-setup does), but then fails later on.

This does not affect the engine database - if it's inaccessible, engine-cleanup emits a warning:

[WARNING] Cannot connect to Engine database using existing credentials: engine@localhost:5432

But then continues and finishes successfully (but without cleaning up the database).

It's not an important bug. Filing it mainly because I ran into it already several times during development, and the error message is cryptic.

Comment 1 Yedidyah Bar David 2018-02-07 08:55:02 UTC
Happened to me again, meaning verification took little time :-), so decided to fix.

Reproduction/Verification flow:

1. Install and setup ovirt+dwh
2. Stop engine, dwh, postgresql
3. Remove postgresql data directory
4. engine-cleanup

Comment 2 Lucie Leistnerova 2018-03-08 12:42:36 UTC
engine-cleanup with inaccessible database showed warning, but did not fail and database data not cleaned.

verified in ovirt-engine-setup-4.2.2.2-0.1.el7.noarch

Comment 3 Sandro Bonazzola 2018-03-29 11:13:27 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

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


Note You need to log in before you can comment on or make changes to this bug.