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

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