Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh pillar cache when saltutil.refresh_pillar is run #60975

Merged
merged 3 commits into from
Oct 8, 2021

Conversation

Ch3LL
Copy link
Contributor

@Ch3LL Ch3LL commented Sep 29, 2021

What does this PR do?

When a user has pillar_cache set to True, the cache will not be refreshed when running salt \* saltutil.refresh_pillar. This PR adds the ability for the cache to be udpated when this is run. This PR still ensures when running a state or pillar.items for example it will not update the cache. When a user is running saltutil.refresh_pillar this would be intentional and would expect the cache to be updated.

What issues does this PR fix or reference?

Fixes: #60897

Previous Behavior

salt \* saltutil.refresh_pillar would not update the pillar cache.

New Behavior

refresh_pillar no updates the pillar cache.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

@Ch3LL Ch3LL requested a review from a team as a code owner September 29, 2021 17:50
@Ch3LL Ch3LL requested review from krionbsd and removed request for a team September 29, 2021 17:50
Copy link
Contributor

@terminalmage terminalmage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple docs nitpicks and one question.

@@ -0,0 +1,2 @@
Clear and update the Pillar Cache when running saltutil.refresh_pillar. This only effects users
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "affects" here.

@@ -386,6 +386,22 @@ updated pillar data, but :py:func:`pillar.item <salt.modules.pillar.item>`,
<salt.modules.pillar.raw>` will not see this data unless refreshed using
:py:func:`saltutil.refresh_pillar <salt.modules.saltutil.refresh_pillar>`.

If your are using the Pillar Cache and have set :conf_master:`pillar_cache` to be `True`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/your/you/

Also, probably don't need to say "to be True", "to True" is probably OK.

salt/minion.py Outdated
@@ -2482,6 +2482,7 @@ def pillar_refresh(self, force_refresh=False):
self.opts["id"],
self.opts["saltenv"],
pillarenv=self.opts.get("pillarenv"),
force_refresh=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

force_refresh is passed through elsewhere, should it really be hardcoded here rather than passing it through?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point, I will make it configurable, so the user can choose not to refresh the pillar cache. I also think I am going to rename force_refresh, since this is a kwarg already used in saltutil.refresh_pillar used for refreshing modules.

@Ch3LL Ch3LL added the Phosphorus v3005.0 Release code name and version label Oct 1, 2021
@Ch3LL Ch3LL force-pushed the pillar_cache branch 2 times, most recently from 22ac03f to 681d2cc Compare October 6, 2021 14:56
@Ch3LL Ch3LL changed the title [WIP] Refresh pillar cache when saltutil.refresh_pillar is run Refresh pillar cache when saltutil.refresh_pillar is run Oct 6, 2021
@Ch3LL
Copy link
Contributor Author

Ch3LL commented Oct 6, 2021

@terminalmage ready for re-review

Copy link
Contributor

@terminalmage terminalmage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@waynew waynew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 looks good. Checked tests against the current salt/main pillar and they just got stuck, and they pass with the current code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Phosphorus v3005.0 Release code name and version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Pillar Cache can't be updated or invalidated
3 participants