remove backwords compatibility.

internally salt doesn't need it. and if someone is using PillarCache
incorrectly that is on them.
This commit is contained in:
Thomas Phipps 2024-04-09 16:48:17 +00:00 committed by Daniel Wozniak
parent 4a8f72a15d
commit 559825c922
2 changed files with 5 additions and 10 deletions

View file

@ -460,15 +460,12 @@ class PillarCache:
"""
return os.path.join(self.opts["cachedir"], "pillar_cache", minion_id)
def fetch_pillar(self, save_override=True):
def fetch_pillar(self):
"""
In the event of a cache miss, we need to incur the overhead of caching
a new pillar.
"""
log.debug("Pillar cache getting external pillar with ext: %s", self.ext)
override = None
if save_override:
override = self.pillar_override
fresh_pillar = Pillar(
self.opts,
self.grains,
@ -476,7 +473,7 @@ class PillarCache:
self.saltenv,
ext=self.ext,
functions=self.functions,
pillar_override=override,
pillar_override=None,
pillarenv=self.pillarenv,
extra_minion_data=self.extra_minion_data,
)
@ -531,7 +528,7 @@ class PillarCache:
return fresh_pillar
else:
# We haven't seen this minion yet in the cache. Store it.
fresh_pillar = self.fetch_pillar(save_override=False)
fresh_pillar = self.fetch_pillar()
self.cache[self.minion_id] = {self.pillarenv: fresh_pillar}
log.debug("Pillar cache miss for minion %s", self.minion_id)
log.debug("Current pillar cache: %s", cache_dict) # FIXME hack!

View file

@ -164,7 +164,7 @@ def test_pillar_get_cache_disk(temp_salt_minion, caplog):
assert fresh_pillar == {}
def test_pillar_save_cache(temp_salt_minion, caplog):
def test_pillar_fetch_pillar_override_skipped(temp_salt_minion, caplog):
with pytest.helpers.temp_directory() as temp_path:
tmp_cachedir = Path(str(temp_path) + "/pillar_cache/")
tmp_cachedir.mkdir(parents=True)
@ -188,10 +188,8 @@ def test_pillar_save_cache(temp_salt_minion, caplog):
pillar_override=pillar_override,
)
fresh_pillar = pillar.fetch_pillar(save_override=False)
fresh_pillar = pillar.fetch_pillar()
assert fresh_pillar == {}
fresh_pillar2 = pillar.fetch_pillar()
assert fresh_pillar2 == pillar_override
def test_remote_pillar_timeout(temp_salt_minion, tmp_path):