mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Fix Ansible sanity issues for new version (#974)
Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
73b7bb1d3e
commit
15423c0a5a
2 changed files with 6 additions and 12 deletions
|
|
@ -9,22 +9,17 @@ import json
|
|||
import os
|
||||
import shutil
|
||||
|
||||
from ansible.module_utils.six import raise_from
|
||||
|
||||
try:
|
||||
from ansible.module_utils.compat.version import LooseVersion # noqa: F401
|
||||
except ImportError:
|
||||
try:
|
||||
from distutils.version import LooseVersion # noqa: F401
|
||||
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,
|
||||
)
|
||||
raise ImportError(
|
||||
"To use this plugin or module with ansible-core"
|
||||
" < 2.11, you need to use Python < 3.12 with "
|
||||
"distutils.version present"
|
||||
) from exc
|
||||
|
||||
ARGUMENTS_OPTS_DICT = {
|
||||
"--attach": ["--attach", "-a"],
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ exec_id:
|
|||
|
||||
|
||||
import shlex
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible_collections.containers.podman.plugins.module_utils.podman.common import (
|
||||
|
|
@ -159,7 +158,7 @@ def run_container_exec(module: AnsibleModule) -> dict:
|
|||
|
||||
if env is not None:
|
||||
for key, value in env.items():
|
||||
if not isinstance(value, string_types):
|
||||
if not isinstance(value, str):
|
||||
module.fail_json(msg="Specify string value %s on the env field" % (value))
|
||||
|
||||
to_text(value, errors="surrogate_or_strict")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue