Skip to content

Conversation

@barpavel
Copy link

SUMMARY

Fixes deprecated ansible.module_utils imports that will be removed in ansible-core 2.24.

This PR addresses deprecation warnings reported in #686 by updating import statements in the synchronize action plugin and mount module to use the new recommended import paths.

Deprecated imports replaced:

synchronize.py:

  • ansible.module_utils._textansible.module_utils.common.text.converters
  • ansible.module_utils.common._collections_compatcollections.abc

mount.py:

  • ansible.module_utils._textansible.module_utils.common.text.converters

Fixes #686

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

synchronize, mount

ADDITIONAL INFORMATION

Testing performed:

  • Built and installed the collection locally with the fixes
  • Tested with ansible-core 2.20.0 and Python 3.14
  • Verified all deprecation warnings are resolved for both modules
  • Confirmed synchronize and mount modules function correctly with no regressions

Before (with deprecation warnings):
[DEPRECATION WARNING]: Importing to_text from ansible.module_utils._text is deprecated.
This feature will be removed from ansible-core version 2.24.
Use ansible.module_utils.common.text.converters instead.

[DEPRECATION WARNING]: The ansible.module_utils.common._collections_compat module is deprecated.
This feature will be removed from ansible-core version 2.24.
Use collections.abc from the Python standard library instead.

After (with fixes applied):
[No deprecation warnings]
Build completed successfully with no ansible.module_utils deprecation warnings.

@softwarefactory-project-zuul
Copy link
Contributor

@barpavel barpavel force-pushed the fix-686-module-utils-deprecation branch 4 times, most recently from 640bd9d to e9e6079 Compare November 27, 2025 00:46
@softwarefactory-project-zuul
Copy link
Contributor

@barpavel barpavel force-pushed the fix-686-module-utils-deprecation branch 2 times, most recently from db3dc32 to 3fb8408 Compare November 27, 2025 01:09
@softwarefactory-project-zuul
Copy link
Contributor

@barpavel
Copy link
Author

The remaining CI failures are pre-existing issues in files not modified by this PR (all showing 0% in the error messages). The files I modified (synchronize.py and mount.py) pass all sanity checks.

Remaining errors (all pre-existing):

  • plugins/callback/cgroup_perf_recap.py:145:0 (0%)
  • plugins/modules/sysctl.py:113:0 (0%)
  • plugins/shell/csh.py:16:0 (0%)
  • plugins/shell/fish.py:16:0 (0%)
  • tests/unit/mock/procenv.py:29:0 (0%)
  • tests/unit/mock/yaml_helper.py:8:0 (0%)
  • tests/unit/modules/conftest.py:12:0 (0%)
  • tests/utils/shippable/timing.py:1:1 (0%)

The 0% indicates these files were not touched by this PR. All files modified by this PR pass their respective sanity checks.

These deprecated imports will be removed in ansible-core 2.24.
Updated to use the new recommended import paths.

- ansible.module_utils._text → ansible.module_utils.common.text.converters
- ansible.module_utils.common._collections_compat → collections.abc

Fixes ansible-collections#686

Co-authored-by: Cursor AI
Signed-off-by: Pavel Bar <pbar@redhat.com>
These deprecated imports will be removed in ansible-core 2.24.
Updated to use the new recommended import paths.

- ansible.module_utils._text → ansible.module_utils.common.text.converters

Related to ansible-collections#686

Co-authored-by: Cursor AI
Signed-off-by: Pavel Bar <pbar@redhat.com>
Replace deprecated ansible.module_utils.six imports with Python 3
standard library equivalents to pass pylint sanity checks.

synchronize.py:
- ansible.module_utils.six.string_types → str
- ansible.module_utils.six.moves.shlex_quote → shlex.quote

mount.py:
- ansible.module_utils.six.iteritems → dict.items()

Related to ansible-collections#686

Co-authored-by: Cursor AI
Signed-off-by: Pavel Bar <pbar@redhat.com>
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 <pbar@redhat.com>
@barpavel barpavel force-pushed the fix-686-module-utils-deprecation branch from 3fb8408 to c19d766 Compare November 28, 2025 14:48
@softwarefactory-project-zuul
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

synchronize: deprecation warning to_text

1 participant