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

Allow to refresh pillar synchronously #50168

Merged
merged 19 commits into from
Nov 29, 2018
Merged

Allow to refresh pillar synchronously #50168

merged 19 commits into from
Nov 29, 2018

Conversation

afischer-opentext-com
Copy link
Contributor

What does this PR do?

This PR adds the optional ability to run saltutil.refresh_pillar Allow to refresh pillar synchronously, saying saltutil.refresh_pillar async=False. I tried to follow the explanatory comment from @gtmanfred and I believe that this works, still I am not sure about the mentioned use of the _gather_pillar() method. I am happy to rework the PR if something is missing.

What issues does this PR fix or reference?

This PR relates to issue #50105

Previous Behavior

It was not possible to know when pillar got really refreshed and the minion is updated properly.

New Behavior

The user can ensure that pillar information is in a refreshed state.

Tests written?

Yes

Commits signed with GPG?

Yes

afischer-opentext-com and others added 2 commits October 23, 2018 09:15
Signed-off-by: Alexander Fischer <afischer@opentext.com>
@afischer-opentext-com afischer-opentext-com requested a review from a team as a code owner October 23, 2018 12:20
@ghost ghost self-requested a review October 23, 2018 12:20
Copy link
Contributor

@gtmanfred gtmanfred left a comment

Choose a reason for hiding this comment

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

This looks great, thanks!

salt/modules/saltutil.py Outdated Show resolved Hide resolved
tests/integration/modules/test_saltutil.py Show resolved Hide resolved
Signed-off-by: Alexander Fischer <afischer@opentext.com>
Signed-off-by: Alexander Fischer <afischer@opentext.com>
salt/minion.py Outdated Show resolved Hide resolved
Signed-off-by: Alexander Fischer <afischer@opentext.com>
@cachedout
Copy link
Contributor

I get where you're going with this but I can't help but wonder if we should just generalize the pattern of "blocking" on a return event somewhere that we can re-use more easily. It seems like this is something that could be used in other places.

Thoughts?

afischer-opentext-com and others added 3 commits October 23, 2018 16:44
…onstants into own module

Signed-off-by: Alexander Fischer <afischer@opentext.com>
…onstants into own module

Signed-off-by: Alexander Fischer <afischer@opentext.com>
@afischer-opentext-com
Copy link
Contributor Author

Yeah, what we basically want is to be sure that minions work with the pillar, grain, state etc. information we expect them to work this, while dealing with an higher amount of saltenvs (using gitfs) which may change quickly. Still, this should be not part of this PR, as it sounds like a lot of planning and requires some deep knowledge of the code base, which I don't have :)

@Oloremo
Copy link
Contributor

Oloremo commented Nov 4, 2018

I'm looking for a way to programmatically check if the pillar data is up to date and could be rendered. I wonder if this PR is what I'm looking for, but based on the change I can't tell if the exit code of synchronously updated pillars will be non-zero in case of an error.

Could you please clarify this?

@afischer-opentext-com
Copy link
Contributor Author

To my understanding the saltutil.refresh_pillar method only guarantees to return False in case of an issue. The return value in case of no issue is not defined. (This does not change with the PR).

salt/defaults/events.py Outdated Show resolved Hide resolved
Copy link
Contributor

@isbm isbm left a comment

Choose a reason for hiding this comment

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

@afischer-opentext-com OK, done. 👍

@afischer-opentext-com
Copy link
Contributor Author

This may be not the smartest question, but what is the next step here, is there something I need to do?

salt/minion.py Outdated Show resolved Hide resolved
Signed-off-by: Alexander Fischer <afischer@opentext.com>
@cachedout cachedout merged commit 53386d2 into saltstack:develop Nov 29, 2018
DmitryKuzmenko added a commit to DSRCorporation/salt that referenced this pull request May 10, 2020
Allow to refresh pillar synchronously
This PR adds the optional ability to run saltutil.refresh_pillar Allow
to refresh pillar synchronously, saying saltutil.refresh_pillar
async=False. I tried to follow the explanatory comment from @gtmanfred
and I believe that this works, still I am not sure about the mentioned
use of the _gather_pillar() method. I am happy to rework the PR if
something is missing.

[DKuzmenko] I've slightly reworked it to resolve conflicts with
functionality added to master by DWoz in saltstack#54942.

Co-authored-by: Dmitry Kuzmenko <dmitry.kuzmenko@dsr-corporation.com>
dwoz added a commit that referenced this pull request May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants