Skip to content

[master] Allow all primitive grain types for autosign_grains - #65232

Merged
Ch3LL merged 2 commits into
saltstack:masterfrom
agraul:autosing_grains_more_types
Oct 9, 2023
Merged

Ch3LL merged 2 commits into
saltstack:masterfrom
agraul:autosing_grains_more_types

Conversation

@agraul

@agraul agraul commented Sep 19, 2023 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Allow non-str grain types for autosign grains. Currently the code is very naive and only compares grain == line, where grain can be any type a grain can be and line is a string. The change casts grain to a str, which makes it easy to use with e.g. numeric grains. More complex autosign_grains, such as nested dicts, are not really covered (str() is not stable across Python versions afaik).

What issues does this PR fix or reference?

Fixes: #61436
Fixes: #63708

Previous Behavior

Autosign_grain with a non-str (e.g. numeric/boolean) grain does not work (never matches the contents of a file in /etc/autosign_grains/).

New Behavior

Autosign_grain with a non-str (e.g. numeric/boolean) grain works.

Merge requirements satisfied?

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

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@agraul
agraul requested a review from a team as a code owner September 19, 2023 14:44
@agraul
agraul requested review from Ch3LL and removed request for a team September 19, 2023 14:44
@salt-project-bot-prod-environment salt-project-bot-prod-environment Bot changed the title Allow all primitive grain types for autosign_grains [master] Allow all primitive grain types for autosign_grains Sep 19, 2023
@agraul
agraul temporarily deployed to ci September 19, 2023 15:01 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 15:01 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 15:02 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 15:02 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 15:19 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 15:21 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:17 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:17 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:18 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:18 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:18 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:18 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:30 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:30 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:30 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:30 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:30 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 19, 2023 16:30 — with GitHub Actions Inactive
@agraul
agraul force-pushed the autosing_grains_more_types branch from 9315937 to a69dd09 Compare September 27, 2023 14:23
@agraul
agraul temporarily deployed to ci September 27, 2023 14:45 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 14:45 — with GitHub Actions Inactive
@agraul
agraul force-pushed the autosing_grains_more_types branch from a69dd09 to 4366b98 Compare September 27, 2023 14:50
@agraul
agraul temporarily deployed to ci September 27, 2023 15:09 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 15:09 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 15:09 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 15:09 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 15:25 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 15:28 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 18:00 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 18:00 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 18:00 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 18:00 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 18:00 — with GitHub Actions Inactive
@agraul
agraul temporarily deployed to ci September 27, 2023 18:00 — with GitHub Actions Inactive
@Ch3LL
Ch3LL merged commit 74f02e8 into saltstack:master Oct 9, 2023
agraul pushed a commit to agraul/salt that referenced this pull request Jan 27, 2025
* Allow all primitive grain types for autosign_grains

Signed-off-by: Marek Czernek <marek.czernek@suse.com>

* blacken daemons/masterapi.py and its test_auto_key

Signed-off-by: Marek Czernek <marek.czernek@suse.com>

---------

Signed-off-by: Marek Czernek <marek.czernek@suse.com>
Co-authored-by: Alexander Graul <agraul@suse.com>

BACKPORT-UPSTREAM=saltstack#65232

This branch was previously deployed

1 inactive deployment
ci — 4366b980 Deployed Sep 27, 2023 by agraul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants