[PR #10852/648ff7db backport][stable-9] yaml cache plugin: make compatible with ansible-core 2.19 (#10854)

yaml cache plugin: make compatible with ansible-core 2.19 (#10852)

Make compatible with ansible-core 2.19.

(cherry picked from commit 648ff7db02)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot]
2025-09-25 07:37:16 +02:00
committed by GitHub
parent 46c63be23a
commit 6230a7a842
2 changed files with 5 additions and 4 deletions

View File

@@ -0,0 +1,2 @@
bugfixes:
- "yaml cache plugin - make compatible with ansible-core 2.19 (https://github.com/ansible-collections/community.general/issues/10849, https://github.com/ansible-collections/community.general/issues/10852)."

View File

@@ -45,8 +45,7 @@ options:
# TODO: determine whether it is OK to change to: type: float
"""
import codecs
import os
import yaml
@@ -61,9 +60,9 @@ class CacheModule(BaseFileCacheModule):
"""
def _load(self, filepath):
with codecs.open(filepath, 'r', encoding='utf-8') as f:
with open(os.path.abspath(filepath), 'r', encoding='utf-8') as f:
return AnsibleLoader(f).get_single_data()
def _dump(self, value, filepath):
with codecs.open(filepath, 'w', encoding='utf-8') as f:
with open(os.path.abspath(filepath), 'w', encoding='utf-8') as f:
yaml.dump(value, f, Dumper=AnsibleDumper, default_flow_style=False)