Skip to content

Commit

Permalink
Don't use deprecated distutils from python 3.10
Browse files Browse the repository at this point in the history
distutils is deprecated in 3.10: https://peps.python.org/pep-0632/
Ansible requires it to be replaced[1]

[1] ansible-community/community-topics#96
ansible-collections/news-for-maintainers#18

Change-Id: I2bae37f206319e8f9ace468f5b94f6be643b6a3c
  • Loading branch information
sshnaidm authored and JM1 committed Jul 27, 2022
1 parent 0215e2a commit ccbbc31
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion plugins/module_utils/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 10 additions & 1 deletion scripts/inventory/openstack_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@
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
Expand Down

0 comments on commit ccbbc31

Please sign in to comment.