From b3a183dc50ba4c4789fa04a9cb68daca2100c3b2 Mon Sep 17 00:00:00 2001 From: Feilong Wang Date: Fri, 9 Aug 2019 10:30:18 +1200 Subject: [PATCH] Fix addon tag/version parsing When doing rolling upgrade, the addon tag/version will be parsed to make sure there is no downgrade. But if there is tag/version is not well-formated, it can't be parsed by pbr.version.SemanticVersion. This patch adds a catch to avoid throwing error and just skip this case. Task: 36186 Story: 2002210 Change-Id: I846cd0fd40a6607c36fff8992d98d8a55c49b3fa --- magnum/drivers/k8s_fedora_atomic_v1/driver.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/magnum/drivers/k8s_fedora_atomic_v1/driver.py b/magnum/drivers/k8s_fedora_atomic_v1/driver.py index 90293ea713..3cd6a42d28 100644 --- a/magnum/drivers/k8s_fedora_atomic_v1/driver.py +++ b/magnum/drivers/k8s_fedora_atomic_v1/driver.py @@ -56,9 +56,15 @@ class Driver(driver.KubernetesDriver): if ((label.endswith('_tag') or label.endswith('_version')) and label in heat_params): current_addons[label] = heat_params[label] - if (SV.from_pip_string(new_addons[label]) < - SV.from_pip_string(current_addons[label])): - raise exception.InvalidVersion(tag=label) + try: + if (SV.from_pip_string(new_addons[label]) < + SV.from_pip_string(current_addons[label])): + raise exception.InvalidVersion(tag=label) + except Exception as e: + # NOTE(flwang): Different cloud providers may use different + # tag/version format which maybe not able to parse by + # SemanticVersion. For this case, let's just skip it. + LOG.debug("Failed to parse tag/version %s", str(e)) heat_params["server_image"] = cluster_template.image_id heat_params["master_image"] = cluster_template.image_id