1
0
mirror of https://github.com/ansible-collections/community.general.git synced 2025-08-01 06:06:57 +03:00

Get rid of distutils.spawn and distutils.util (#3934)

* Replace distutils.spawn.find_executable.

* Replace distutils.util.strtobool.
This commit is contained in:
Felix Fontein
2022-01-04 06:56:28 +01:00
committed by GitHub
parent 87ae203a7d
commit 77b7b4f75b
6 changed files with 36 additions and 27 deletions

View File

@ -43,10 +43,10 @@ DOCUMENTATION = '''
'''
import os
from distutils.spawn import find_executable
from subprocess import Popen, PIPE
from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNotFound
from ansible.module_utils.common.process import get_bin_path
from ansible.module_utils.common.text.converters import to_bytes, to_text
from ansible.plugins.connection import ConnectionBase
@ -62,9 +62,9 @@ class Connection(ConnectionBase):
super(Connection, self).__init__(play_context, new_stdin, *args, **kwargs)
self._host = self._play_context.remote_addr
self._lxc_cmd = find_executable("lxc")
if not self._lxc_cmd:
try:
self._lxc_cmd = get_bin_path("lxc")
except ValueError:
raise AnsibleError("lxc command not found in PATH")
if self._play_context.remote_user is not None and self._play_context.remote_user != 'root':