Skip to content

Commit

Permalink
fixes saltstack#66262 pillar.ls doesn't accept kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasmhughes committed Mar 23, 2024
1 parent 35bc5fc commit d78f515
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/66262.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed pillar.ls doesn't accept kwargs
4 changes: 2 additions & 2 deletions salt/modules/pillar.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def obfuscate(*args, **kwargs):

# naming chosen for consistency with grains.ls, although it breaks the short
# identifier rule.
def ls(*args):
def ls(*args, **kwargs):
"""
.. versionadded:: 2015.8.0
Expand All @@ -342,7 +342,7 @@ def ls(*args):
salt '*' pillar.ls
"""

return list(items(*args))
return list(items(*args, **kwargs))


def item(*args, **kwargs):
Expand Down
6 changes: 6 additions & 0 deletions tests/pytests/unit/modules/test_pillar.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,9 @@ def test_pillar_keys():
test_key = "7:11"
res = pillarmod.keys(test_key)
assert res == ["12"]


def test_ls_pass_kwargs(pillar_value):
with patch("salt.modules.pillar.items", MagicMock(return_value=pillar_value)):
ls = sorted(pillarmod.ls(pillarenv="base"))
assert ls == ["a", "b"]

0 comments on commit d78f515

Please sign in to comment.