Fix deprecated imports in plugins/modules/sysctl.py

Replace deprecated module_utils imports:
- ansible.module_utils._text -> ansible.module_utils.common.text.converters
- ansible.module_utils.six.string_types -> basestring/str (Python 2/3 compatible)

Fixes #686

Co-authored-by: Cursor AI
Signed-off-by: Pavel Bar <pbar@redhat.com>
This commit is contained in:
Pavel Bar
2026-02-15 22:56:50 +02:00
parent 35bcea6ec9
commit 17dd3b2e01
3 changed files with 10 additions and 4 deletions

View File

@@ -107,12 +107,20 @@ EXAMPLES = r'''
import os
import platform
import re
import sys
import tempfile
# TODO(Python2): On Python 2, string_types is basestring (str + unicode).
# This module may run on target hosts with Python 2.7.
# Remove the Python 2 branch when Python 2 support is dropped.
if sys.version_info >= (3, 0):
string_types = str
else:
string_types = basestring # pylint: disable=undefined-variable
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import string_types
from ansible.module_utils.common.text.converters import to_native
from ansible.module_utils.parsing.convert_bool import BOOLEANS_FALSE, BOOLEANS_TRUE
from ansible.module_utils._text import to_native
class SysctlModule(object):