-
Notifications
You must be signed in to change notification settings - Fork 171
Fix deprecated module_utils imports (synchronize, mount) #690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix deprecated module_utils imports (synchronize, mount) #690
Conversation
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 29s |
640bd9d to
e9e6079
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 27s |
db3dc32 to
3fb8408
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 23s |
|
The remaining CI failures are pre-existing issues in files not modified by this PR (all showing Remaining errors (all pre-existing):
The |
3fb8408 to
c19d766
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 29s |
|
also needs conversions for |
versions of ansible-core, ok pvk@ mostly from ansible-collections/ansible.posix#690
c19d766 to
0f0cb76
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 37s |
ffabe10 to
4a7182b
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 36s |
3de63b8 to
9fea277
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 25s |
9fea277 to
11901c0
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 18s |
Replace deprecated module_utils imports: - ansible.module_utils._text -> ansible.module_utils.common.text.converters - ansible.module_utils.common._collections_compat -> collections.abc Fixes ansible-collections#686
Replace deprecated module_utils import: - ansible.module_utils._text -> ansible.module_utils.common.text.converters Fixes ansible-collections#686
Replace deprecated module_utils imports: - ansible.module_utils._text -> ansible.module_utils.common.text.converters Fixes ansible-collections#686
5838c37 to
93cd49a
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 33s |
Replace deprecated ansible.module_utils.six imports with Python 3 standard library equivalents to pass pylint sanity checks. plugins/action/synchronize.py: - ansible.module_utils.six.string_types → str - ansible.module_utils.six.moves.shlex_quote → shlex.quote plugins/modules/synchronize.py: - ansible.module_utils.six.moves.shlex_quote → shlex.quote plugins/modules/mount.py: - ansible.module_utils.six.iteritems → dict.items()
Added changelog entry documenting the bugfixes for synchronize and mount modules' deprecated import issues. Related to ansible-collections#686 Co-authored-by: Cursor AI Signed-off-by: Pavel Bar <[email protected]>
93cd49a to
64a81b4
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 44s |
|
@sthen Thank you for reviewing! I've addressed your comment and added the missing conversions for CI Status: ✅ All 56 checks passing! Note on Python 2 compatibility: The # TODO(Python2): shlex.quote was added in Python 3.3. This module may run on
# target hosts with Python 2.7 (e.g., older RHEL systems in CI integration tests).
# Remove the try/except fallback to pipes.quote when Python 2 support is dropped.
try:
from shlex import quote as shlex_quote
except ImportError:
from pipes import quote as shlex_quoteThis is necessary because modules run on target hosts which may still be Python 2.7 (e.g., CentOS 7). When I initially used Side note: It might be worth considering updating the CI test matrix to drop Python 2 targets (like CentOS 7), given that Python 2 reached end-of-life in January 2020 and ansible-core 2.12+ no longer supports Python 2 on the controller. |
SUMMARY
Fixes deprecated
ansible.module_utilsimports that will be removed in ansible-core 2.24.This PR addresses deprecation warnings reported in #686 by updating import statements in the
plugins/action/synchronize.pyaction plugin,plugins/modules/synchronize.pymodule, andplugins/modules/mount.pymodule to use the new recommended import paths.Deprecated imports replaced:
plugins/action/synchronize.py:
ansible.module_utils._text→ansible.module_utils.common.text.convertersansible.module_utils.common._collections_compat→collections.abcansible.module_utils.six→ Python 3 standard library (CI compliance)plugins/modules/synchronize.py:
ansible.module_utils._text→ansible.module_utils.common.text.convertersansible.module_utils.six→ Python 3 standard library (CI compliance)plugins/modules/mount.py:
ansible.module_utils._text→ansible.module_utils.common.text.convertersansible.module_utils.six→ Python 3 standard library (CI compliance)Fixes #686
ISSUE TYPE
COMPONENT NAME
plugins/action/synchronize.py, plugins/modules/synchronize.py, plugins/modules/mount.py
ADDITIONAL INFORMATION
Testing performed:
ansible-core 2.18.12and Python 3synchronizeandmountmodules function correctly with no regressionsBefore (with deprecation warnings):
[DEPRECATION WARNING]: Importing
to_textfromansible.module_utils._textis deprecated.This feature will be removed from ansible-core version 2.24.
Use
ansible.module_utils.common.text.convertersinstead.[DEPRECATION WARNING]: The
ansible.module_utils.common._collections_compatmodule is deprecated.This feature will be removed from ansible-core version 2.24.
Use
collections.abcfrom the Python standard library instead.After (with fixes applied):
[No deprecation warnings]
Build completed successfully with no
ansible.module_utilsdeprecation warnings.