Handle failed neutron-plugin-ml2.yaml lookup

This handles the puppet/services/neutron-plugin-ml2.yaml template
GET failure by simply hard coding the 'ovn' default which matches
the latest t-h-t templates default anyway for this template.

Change-Id: Ic7c1817671467f4ec2ef823f52e165c2c1f230ca
This commit is contained in:
Dan Prince 2019-05-13 09:58:28 -04:00
parent 1594218f35
commit feb49b8c16

View File

@ -76,18 +76,23 @@ def check_neutron_mechanism_drivers(env, stack, plan_client, container):
if configured_drivers:
new_driver = get_exclusive_neutron_driver(configured_drivers)
else:
# TODO(beagles): we need to look for a better way to
# get the current template default value. This is fragile
# with respect to changing filenames, etc.
ml2_tmpl = swiftutils.get_object_string(
plan_client,
container,
'puppet/services/neutron-plugin-ml2.yaml')
ml2_def = yaml.safe_load(ml2_tmpl)
default_drivers = ml2_def.get('parameters', {}).get(driver_key,
{}).get('default')
new_driver = get_exclusive_neutron_driver(default_drivers)
try:
# TODO(beagles): we need to look for a better way to
# get the current template default value. This is fragile
# with respect to changing filenames, etc.
ml2_tmpl = swiftutils.get_object_string(
plan_client,
container,
'puppet/services/neutron-plugin-ml2.yaml')
ml2_def = yaml.safe_load(ml2_tmpl)
default_drivers = ml2_def.get(
'parameters', {}).get(driver_key, {}).get('default')
new_driver = get_exclusive_neutron_driver(default_drivers)
except Exception:
# NOTE: we restructured t-h-t in stein, if this happens we
# assume neutron-plugin-ml2.yaml has been moved and
# thus set the most recent default (OVN)
new_driver = 'ovn'
if current_driver and new_driver and current_driver != new_driver:
msg = ("Unable to switch from {} to {} neutron "
"mechanism drivers on upgrade. Please consult the "