Don't use deprecated distutils from python 3.10

distutils is deprecated in 3.10: https://peps.python.org/pep-0632/
Ansible requires it to be replaced[1]

[1] https://github.com/ansible-community/community-topics/issues/96
https://github.com/ansible-collections/news-for-maintainers/issues/18

Change-Id: I2bae37f206319e8f9ace468f5b94f6be643b6a3c
(cherry picked from commit ccbbc319ce)
changes/23/859423/1
Sagi Shnaidman 4 months ago committed by Jakob Meng
parent 17e78e5173
commit 7772bf125d
  1. 11
      plugins/module_utils/openstack.py
  2. 11
      scripts/inventory/openstack_inventory.py

@ -29,7 +29,16 @@
import abc
import copy
from distutils.version import StrictVersion
from ansible.module_utils.six import raise_from
try:
from ansible.module_utils.compat.version import StrictVersion
except ImportError:
try:
from distutils.version import StrictVersion
except ImportError as exc:
raise_from(ImportError('To use this plugin or module with ansible-core'
' < 2.11, you need to use Python < 3.12 with '
'distutils.version present'), exc)
import importlib
import os

@ -56,7 +56,16 @@ import collections
import os
import sys
import time
from distutils.version import StrictVersion
from ansible.module_utils.six import raise_from
try:
from ansible.module_utils.compat.version import StrictVersion
except ImportError:
try:
from distutils.version import StrictVersion
except ImportError as exc:
raise_from(ImportError('To use this plugin or module with ansible-core'
' < 2.11, you need to use Python < 3.12 with '
'distutils.version present'), exc)
from io import StringIO
import json

Loading…
Cancel
Save