Bug 1469974

Summary: engine-setup fails due to some : Command '/usr/share/ovirt-engine/dbscripts/schema.sh' failed to execute
Product: Red Hat Enterprise Virtualization Manager Reporter: Tareq Alayan <talayan>
Component: ovirt-engineAssignee: Eli Mesika <emesika>
Status: CLOSED WONTFIX QA Contact: meital avital <mavital>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: lsurette, mperina, rbalakri, Rhev-m-bugs, srevivo, ykaul
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-07-12 08:50:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine-setup-log
none
db-dump none

Description Tareq Alayan 2017-07-12 07:49:25 UTC
Description of problem:
fail to run engine-setup 

Version-Release number of selected component (if applicable):
rhevm-3.6.11.3-0.1.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. i have rhevm-3.6.11.3-0.1.el6.noarch 
2. added repos for 3.6.12 (there is no updates for engine)
3. ran engine-setup 

Actual results:
[ ERROR ] Failed to execute stage 'Misc configuration': Command '/usr/share/ovirt-engine/dbscripts/schema.sh' failed to execute

snipet from log:
2017-07-12 10:05:11 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.schema plugin.execute:941 execute-output: ['/usr/share/ovirt-engine/dbscripts/schema.sh', '-s', 'localhost', '-p', '5432', '-u', 'engine
', '-d', 'engine', '-l', '/var/log/ovirt-engine/setup/ovirt-engine-setup-20170712100438-qske9v.log', '-c', 'apply'] stderr:
psql:/usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade/0030_set_default_cluster_for_registration.sql:19: ERROR:  null value in column "option_value" violates not-null constraint
CONTEXT:  SQL statement "update vdc_options set option_value = (select vds_group_id from vds_groups LIMIT 1) where option_name = 'AutoRegistrationDefaultVdsGroupID' and version = 'general'"
PL/pgSQL function "__temp_set_default_cluster_for_registration" line 9 at SQL statement
FATAL: Cannot execute sql command: --file=/usr/share/ovirt-engine/dbscripts/upgrade/post_upgrade/0030_set_default_cluster_for_registration.sql

2017-07-12 10:05:11 DEBUG otopi.context context._executeMethod:156 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/otopi/context.py", line 146, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/ovirt-engine/db/schema.py", line 291, in _misc
    oenginecons.EngineDBEnv.PGPASS_FILE
  File "/usr/lib/python2.6/site-packages/otopi/plugin.py", line 946, in execute
    command=args[0],
RuntimeError: Command '/usr/share/ovirt-engine/dbscripts/schema.sh' failed to execute
2017-07-12 10:05:11 ERROR otopi.context context._executeMethod:165 Failed to execute stage 'Misc configuration': Command '/usr/share/ovirt-engine/dbscripts/schema.sh' failed to execute
2017-07-12 10:05:11 DEBUG otopi.transaction transaction.abort:134 aborting 'Yum Transaction'
2017-07-12 10:05:11 INFO otopi.plugins.otopi.packagers.yumpackager yumpackager.info:95 Yum Performing yum transaction rollback
Loaded plugins: product-id, versionlock

Expected results:
run with no errors even that there is no updates for engine 

Additional info:

Comment 1 Tareq Alayan 2017-07-12 07:50:44 UTC
Created attachment 1296771 [details]
engine-setup-log

Comment 2 Tareq Alayan 2017-07-12 08:31:39 UTC
Created attachment 1296779 [details]
db-dump

Comment 3 Martin Perina 2017-07-12 08:50:26 UTC
The issue is happening if you don't have any cluster in your system, which means you don't have any hosts/VMs in your setup. If that's the case why would you want to upgrade such setup?

I'm closing as WONTFIX as I think it's not worth to fix this case (it is highly unlikely to happen in production)