mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-07 08:54:01 -07:00
Implement fact cache flushing alongside a command-line argument to invoke it.
This commit is contained in:
parent
aa419044c4
commit
917e868f65
7 changed files with 32 additions and 7 deletions
10
lib/ansible/cache/file.py
vendored
10
lib/ansible/cache/file.py
vendored
|
@ -47,13 +47,13 @@ class CacheModule(MemoryCacheModule):
|
|||
|
||||
def set(self, *args, **kwargs):
|
||||
super(CacheModule, self).set(*args, **kwargs)
|
||||
self.flush()
|
||||
self.fsync()
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
super(CacheModule, self).delete(*args, **kwargs)
|
||||
self.flush()
|
||||
self.fsync()
|
||||
|
||||
def flush(self):
|
||||
def fsync(self):
|
||||
temp = tempfile.TemporaryFile('r+b')
|
||||
|
||||
try:
|
||||
|
@ -63,3 +63,7 @@ class CacheModule(MemoryCacheModule):
|
|||
shutil.copyfileobj(temp, f)
|
||||
finally:
|
||||
temp.close()
|
||||
|
||||
def flush(self):
|
||||
super(CacheModule, self).flush()
|
||||
self.fsync()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue