Blame SOURCES/0005-command-fix-optional-BLS-key-to-command-line-argumen.patch

a7c477
 boom/command.py        |  5 +++--
a7c477
 tests/command_tests.py | 16 ++++++++++++++++
a7c477
 2 files changed, 19 insertions(+), 2 deletions(-)
a7c477
a7c477
diff --git a/boom/command.py b/boom/command.py
a7c477
index c9c2f6b..feb5b65 100644
a7c477
--- a/boom/command.py
a7c477
+++ b/boom/command.py
a7c477
@@ -1883,7 +1883,8 @@ def _optional_key_to_arg(optional_key):
a7c477
     _key_map = {
a7c477
         BOOM_ENTRY_GRUB_USERS: "--grub-users",
a7c477
         BOOM_ENTRY_GRUB_ARG: "--grub-arg",
a7c477
-        BOOM_ENTRY_GRUB_CLASS: "--grub-class"
a7c477
+        BOOM_ENTRY_GRUB_CLASS: "--grub-class",
a7c477
+        BOOM_ENTRY_GRUB_ID: "--grub-id"
a7c477
     }
a7c477
     return _key_map[optional_key] if optional_key in _key_map else None
a7c477
 
a7c477
@@ -1914,7 +1915,7 @@ def _set_optional_key_defaults(profile, cmd_args):
a7c477
         if bls_key not in profile.optional_keys:
a7c477
             if getattr(cmd_args, bls_key) is not None:
a7c477
                 print("Profile with os_id='%s' does not support %s" %
a7c477
-                      (profile.disp_os_id, _optional_key_to_arg(bls_key)))
a7c477
+                      (profile.disp_os_id, _optional_key_to_arg(opt_key)))
a7c477
                 return 1
a7c477
         else:
a7c477
             if getattr(cmd_args, bls_key) is None:
a7c477
diff --git a/tests/command_tests.py b/tests/command_tests.py
a7c477
index 00cda3b..d7a766a 100644
a7c477
--- a/tests/command_tests.py
a7c477
+++ b/tests/command_tests.py
a7c477
@@ -244,6 +244,22 @@ class CommandHelperTests(unittest.TestCase):
a7c477
         (add_opts, del_opts) = _merge_add_del_opts(bp, to_add, to_del)
a7c477
         self.assertEqual(["log_buf_len=16M", "debug"], add_opts)
a7c477
 
a7c477
+    def test__optional_key_to_arg_valid(self):
a7c477
+        _optional_key_to_arg = boom.command._optional_key_to_arg
a7c477
+        valid_keys_and_args = {
a7c477
+            "BOOM_ENTRY_GRUB_USERS": "--grub-users",
a7c477
+            "BOOM_ENTRY_GRUB_ARG": "--grub-arg",
a7c477
+            "BOOM_ENTRY_GRUB_CLASS": "--grub-class",
a7c477
+            "BOOM_ENTRY_GRUB_ID": "--grub-id"
a7c477
+        }
a7c477
+        for opt_key in valid_keys_and_args.keys():
a7c477
+            self.assertEqual(_optional_key_to_arg(opt_key),
a7c477
+                             valid_keys_and_args[opt_key])
a7c477
+
a7c477
+    def test__optional_key_to_arg_invalid(self):
a7c477
+        _optional_key_to_arg = boom.command._optional_key_to_arg
a7c477
+        self.assertEqual(_optional_key_to_arg("INVALID_KEY"), None)
a7c477
+
a7c477
 
a7c477
 # Default test OsProfile identifiers
a7c477
 test_os_id = "9cb53ddda889d6285fd9ab985a4c47025884999f"