mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Allow all primitive grain types for autosign_grains
This commit is contained in:
parent
6e64117996
commit
31146eae69
4 changed files with 7 additions and 4 deletions
1
changelog/61416.fixed.md
Normal file
1
changelog/61416.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Allow all primitive grain types for autosign_grains
|
1
changelog/63708.fixed.md
Normal file
1
changelog/63708.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Allow all primitive grain types for autosign_grains
|
|
@ -380,7 +380,7 @@ class AutoKey:
|
|||
line = salt.utils.stringutils.to_unicode(line).strip()
|
||||
if line.startswith("#"):
|
||||
continue
|
||||
if autosign_grains[grain] == line:
|
||||
if str(autosign_grains[grain]) == line:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -256,16 +256,17 @@ def test_check_autosign_grains_no_autosign_grains_dir(auto_key):
|
|||
_test_check_autosign_grains(test_func, auto_key, autosign_grains_dir=None)
|
||||
|
||||
|
||||
def test_check_autosign_grains_accept(auto_key):
|
||||
@pytest.mark.parametrize("grain_value", ["test_value", 123, True])
|
||||
def test_check_autosign_grains_accept(grain_value, auto_key):
|
||||
"""
|
||||
Asserts that autosigning from grains passes when a matching grain value is in an
|
||||
autosign_grain file.
|
||||
"""
|
||||
|
||||
def test_func(*args):
|
||||
assert auto_key.check_autosign_grains({"test_grain": "test_value"}) is True
|
||||
assert auto_key.check_autosign_grains({"test_grain": grain_value}) is True
|
||||
|
||||
file_content = "#test_ignore\ntest_value"
|
||||
file_content = f"#test_ignore\n{grain_value}"
|
||||
_test_check_autosign_grains(test_func, auto_key, file_content=file_content)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue