mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00:00
yaml cache plugin: make compatible with ansible-core 2.19 (#10852)
Make compatible with ansible-core 2.19.
This commit is contained in:
7
plugins/cache/yaml.py
vendored
7
plugins/cache/yaml.py
vendored
@@ -44,8 +44,7 @@ options:
|
||||
# TODO: determine whether it is OK to change to: type: float
|
||||
"""
|
||||
|
||||
|
||||
import codecs
|
||||
import os
|
||||
|
||||
import yaml
|
||||
|
||||
@@ -60,9 +59,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)
|
||||
|
||||
Reference in New Issue
Block a user