File fix-string-replacement.diff of Package cobbler
Index: cobbler-3.1.2/cobbler/templar.py
===================================================================
--- cobbler-3.1.2.orig/cobbler/templar.py
+++ cobbler-3.1.2/cobbler/templar.py
@@ -141,7 +141,7 @@ class Templar(object):
search_table["http_server"] = repstr
# string replacements for @@xyz@@ in data_out with prior regex lookups of keys
- regex = r"@@[a-zA-Z]*@@"
+ regex = r"@@[\S]*?@@"
matches = re.finditer(regex, data_out, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
data_out = data_out.replace(match.group(), search_table[str(match.group()).strip("@@")])
Index: cobbler-3.1.2/tests/xmlrpcapi/distro_profile_system_test.py
===================================================================
--- cobbler-3.1.2.orig/tests/xmlrpcapi/distro_profile_system_test.py
+++ cobbler-3.1.2/tests/xmlrpcapi/distro_profile_system_test.py
@@ -1157,3 +1157,20 @@ class TestDistroProfileSystem:
# Assert --> Let the test pass if the call is okay.
assert True
+
+ @pytest.mark.usefixtures("create_testdistro", "create_profile", "remove_testdistro", "remove_testprofile")
+ def test_render_vars(self, remote, token):
+ """
+ Test: string replacements for @@xyz@@
+ """
+
+ # Arrange --> There is nothing to be arranged
+ kernel_options = "tree=http://@@http_server@@/cblr/links/@@distro_name@@"
+
+ # Act
+ distro = remote.get_item_handle("distro", "testdistro0", token)
+ remote.modify_distro(distro, "kernel_options", kernel_options, token)
+ remote.save_distro(distro, token)
+
+ # Assert --> Let the test pass if the call is okay.
+ assert True