Fix no floating_network_name option

If there is no public network set, python-tempestconf doesn't
set network.floating_network_name option. In order to avoid
the following error when heat_plugin options are being set:
No option 'floating_network_name' in section: 'network'
the commit adds a try except block to catch this situation
and log it for the user.

Change-Id: Ib1f04584b620fc662fd415c4430a03ea92c35b76
This commit is contained in:
Martin Kopec 2022-02-21 15:43:38 +00:00
parent e30addb390
commit 490a7ea40b
1 changed files with 8 additions and 3 deletions

View File

@ -117,6 +117,11 @@ class OrchestrationService(Service):
conf.set('heat_plugin', 'image_ref',
conf.get('compute', 'image_ref_alt'))
if conf.has_section('network'):
network = conf.get('network', 'floating_network_name')
conf.set('heat_plugin', 'network_for_ssh', network)
conf.set('heat_plugin', 'floating_network_name', network)
try:
network = conf.get('network', 'floating_network_name')
conf.set('heat_plugin', 'network_for_ssh', network)
conf.set('heat_plugin', 'floating_network_name', network)
except configparser.NoOptionError:
LOG.info("heat_plugin.network_for_ssh and heat_plugin."
"floating_network_name are not set because there "
"is no floating network")