diff --git a/contrib/heat_docker/heat_docker/resources/docker_container.py b/contrib/heat_docker/heat_docker/resources/docker_container.py index a6703bc169..fb7a084f2c 100644 --- a/contrib/heat_docker/heat_docker/resources/docker_container.py +++ b/contrib/heat_docker/heat_docker/resources/docker_container.py @@ -14,9 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import distutils - from oslo_log import log as logging +import packaging.version from heat.common import exception from heat.common.i18n import _ @@ -558,8 +557,8 @@ def available_resource_mapping(): def compare_version(v1, v2): - s1 = distutils.version.StrictVersion(v1) - s2 = distutils.version.StrictVersion(v2) + s1 = packaging.version.Version(v1) + s2 = packaging.version.Version(v2) if s1 == s2: return 0 elif s1 > s2: diff --git a/heat/cloudinit/loguserdata.py b/heat/cloudinit/loguserdata.py index 413f3a7582..14d17f2983 100755 --- a/heat/cloudinit/loguserdata.py +++ b/heat/cloudinit/loguserdata.py @@ -34,7 +34,6 @@ exec $interpreter "$0" ''' import datetime -from distutils import version import errno import logging import os @@ -42,6 +41,7 @@ import re import subprocess import sys +from packaging import version import pkg_resources @@ -51,9 +51,9 @@ LOG = logging.getLogger('heat-provision') def chk_ci_version(): try: - v = version.LooseVersion( + v = version.Version( pkg_resources.get_distribution('cloud-init').version) - return v >= version.LooseVersion('0.6.0') + return v >= version.Version('0.6.0') except Exception: pass data = subprocess.Popen(['cloud-init', '--version'], diff --git a/requirements.txt b/requirements.txt index dddc4239e1..71aaf3662d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,6 +35,7 @@ osprofiler>=1.4.0 # Apache-2.0 oslo.versionedobjects>=1.31.2 # Apache-2.0 PasteDeploy>=1.5.0 # MIT aodhclient>=0.9.0 # Apache-2.0 +packaging>=21.0 # Apache-2.0 python-barbicanclient>=4.5.2 # Apache-2.0 python-blazarclient>=1.0.1 # Apache-2.0 python-cinderclient>=3.3.0 # Apache-2.0