summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyanaconda/bootloader.py12
-rw-r--r--tests/pyanaconda_test/bootloader_test.py8
2 files changed, 19 insertions, 1 deletions
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index cecca6e70..6cc7d0404 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -79,6 +79,11 @@ class BootLoaderError(Exception):
pass
class Arguments(set):
+ ordering_dict = {
+ "rhgb" : 99,
+ "quiet" : 100
+ }
+
def _merge_ip(self):
"""
Find ip= arguments targetting the same interface and merge them.
@@ -111,7 +116,12 @@ class Arguments(set):
def __str__(self):
self._merge_ip()
- return " ".join(self)
+ # sort the elements according to their values in ordering_dict. The
+ # higher the number the closer to the final string the argument
+ # gets. The default is 50.
+ lst = sorted(self, key=lambda s: self.ordering_dict.get(s, 50))
+
+ return " ".join(lst)
class BootLoaderImage(object):
""" Base class for bootloader images. Suitable for non-linux OS images. """
diff --git a/tests/pyanaconda_test/bootloader_test.py b/tests/pyanaconda_test/bootloader_test.py
index 59b6ea22b..6aa93bb71 100644
--- a/tests/pyanaconda_test/bootloader_test.py
+++ b/tests/pyanaconda_test/bootloader_test.py
@@ -49,3 +49,11 @@ class ArgumentsTest(mock.TestCase):
self.assertEqual(str(a), "ip=eth0:dhcp")
a = Arguments(["ip=eth0:dhcp", "ip=eth0:auto6"])
assert(str(a) in ["ip=eth0:auto6,dhcp", "ip=eth0:dhcp,auto6"])
+
+ def test_sorting(self):
+ from pyanaconda.bootloader import Arguments
+ a = Arguments(["ip=eth0:dhcp", "rhgb", "quiet",
+ "root=/dev/mapper/destroyers-rubies", "rd.md=0",
+ "rd.luks=0"])
+ # 'rhgb quiet' should be the final entries:
+ assert(str(a).endswith("rhgb quiet"))