mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Fix an issue with whitespace in the element alias
The specific example is the "Allow Online Tips" policy that contains a newline and 10 spaces before the text of the policy.
This commit is contained in:
parent
d18f3dc8de
commit
7ce54c9c67
3 changed files with 37 additions and 2 deletions
1
changelog/62058.fixed
Normal file
1
changelog/62058.fixed
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fixed issue with some LGPO policies having whitespace at the beginning or end of the element alias
|
|
@ -5956,9 +5956,9 @@ def _getAdmlPresentationRefId(adml_data, ref_id):
|
||||||
"multiTextBox",
|
"multiTextBox",
|
||||||
]:
|
]:
|
||||||
if result.text:
|
if result.text:
|
||||||
return result.text.rstrip().rstrip(":")
|
return result.text.rstrip().rstrip(":").strip()
|
||||||
else:
|
else:
|
||||||
return alternate_label.rstrip(":")
|
return alternate_label.rstrip(":").strip()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
"""
|
||||||
|
Unit tests for the LGPO module
|
||||||
|
"""
|
||||||
|
|
||||||
|
import platform
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
|
pytestmark = [
|
||||||
|
pytest.mark.windows_whitelisted,
|
||||||
|
pytest.mark.skip_unless_on_windows,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def lgpo(modules):
|
||||||
|
return modules.lgpo
|
||||||
|
|
||||||
|
|
||||||
|
# The "Allow Online Tips" policy only became available in version 10.0.16299
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
version.parse(platform.version()) < version.parse("10.0.16299"),
|
||||||
|
reason="Policy only available on 10.0.16299 or later",
|
||||||
|
)
|
||||||
|
def test_62058_whitespace(lgpo):
|
||||||
|
result = lgpo.get_policy_info("Allow Online Tips", "machine")
|
||||||
|
for element in result["policy_elements"]:
|
||||||
|
if "element_aliases" in element:
|
||||||
|
assert (
|
||||||
|
"Allow Settings to retrieve online tips." in element["element_aliases"]
|
||||||
|
)
|
||||||
|
return
|
||||||
|
assert False
|
Loading…
Add table
Reference in a new issue