Update compute config only when compute section exists

In nova less deployment, nova service is not there, so there will
be no compute section in the tempest.conf byut when heat service
got detected, it tries to update the compute section which does
not exists leading to no section error.

It fixes the same.

Closes-Bug: #1860017

Change-Id: Id793975b2cc30038638275fe9f381ae21e6369bc
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
Chandan Kumar (raukadah) 2020-01-17 14:16:27 +05:30
parent 9f9ed67d30
commit 48ab2ddb5d
1 changed files with 14 additions and 13 deletions

View File

@ -65,16 +65,17 @@ class OrchestrationService(Service):
"heat_tempest_plugin cannot be set!")
def post_configuration(self, conf, is_service):
compute_options = conf.options('compute')
if 'flavor_ref' in compute_options:
conf.set('heat_plugin', 'minimal_instance_type',
conf.get('compute', 'flavor_ref'))
if 'flavor_ref_alt' in compute_options:
conf.set('heat_plugin', 'instance_type',
conf.get('compute', 'flavor_ref_alt'))
if 'image_ref' in compute_options:
conf.set('heat_plugin', 'minimal_image_ref',
conf.get('compute', 'image_ref'))
if 'image_ref_alt' in compute_options:
conf.set('heat_plugin', 'image_ref',
conf.get('compute', 'image_ref_alt'))
if conf.has_section('compute'):
compute_options = conf.options('compute')
if 'flavor_ref' in compute_options:
conf.set('heat_plugin', 'minimal_instance_type',
conf.get('compute', 'flavor_ref'))
if 'flavor_ref_alt' in compute_options:
conf.set('heat_plugin', 'instance_type',
conf.get('compute', 'flavor_ref_alt'))
if 'image_ref' in compute_options:
conf.set('heat_plugin', 'minimal_image_ref',
conf.get('compute', 'image_ref'))
if 'image_ref_alt' in compute_options:
conf.set('heat_plugin', 'image_ref',
conf.get('compute', 'image_ref_alt'))