Repository: stratis-storage/stratis-cli (language: python)

Issue:
Remove dead key_description parameter from binding
Closes #733 
Investigate removing key description as a parameter for binding to Clevis
We may not need to pass in the key description as a parameter to the Clevis bind command because it's stored in our metadata.


Discussion / hints:

This is purely on the CLI side. It's only referenced in the parser and never actually used. Migrating.

Fix patch:
diff --git a/docs/stratis.txt b/docs/stratis.txt
index a88f43057..cb4f4c6ca 100644
--- a/docs/stratis.txt
+++ b/docs/stratis.txt
@@ -58,15 +58,13 @@ pool unlock <(keyring | clevis)>::
      Unlock all devices that are part of an encrypted pool registered with stratisd
      but that have not yet been opened. The available unlock methods are
      *keyring* or *clevis*.
-pool bind <(nbde|tang)> <pool name> <key description> <url> <(--thumbprint <thp> | --trust-url)>::
+pool bind <(nbde|tang)> <pool name> <url> <(--thumbprint <thp> | --trust-url)>::
      Bind the devices in the specified pool to a supplementary encryption
      mechanism that uses NBDE (Network-Bound Disc Encryption). *tang* is
-     an alias for *nbde*. The description of the key in the kernel keyring
-     used to encrypt the devices must be supplied.
-pool bind tpm2 <pool name> <key description>::
+     an alias for *nbde*.
+pool bind tpm2 <pool name>::
      Bind the devices in the specified pool to a supplementary encryption
-     mechanism that uses TPM 2.0 (Trusted Platform Module). The description of
-     the key in the kernel keyring used to encrypt the devices must be supplied.
+     mechanism that uses TPM 2.0 (Trusted Platform Module).
 pool unbind <pool name>::
      Unbind the devices in the specified pool from an existing supplementary
      encryption mechanism. Unbinding leaves the primary encryption mechanism,
@@ -226,7 +224,7 @@ stratis filesystem create mypool data1
 ====
 .Binding a pool's devices to use an NBDE policy for decryption
 ====
-stratis pool bind nbde --trust-url mypool someKeyDescription someTangServerUrl
+stratis pool bind nbde --trust-url mypool someTangServerUrl
 ====
 
 SEE ALSO
diff --git a/src/stratis_cli/_parser/_bind.py b/src/stratis_cli/_parser/_bind.py
index 21cbdd93c..16ed965b6 100644
--- a/src/stratis_cli/_parser/_bind.py
+++ b/src/stratis_cli/_parser/_bind.py
@@ -24,13 +24,6 @@
             help="Bind using NBDE via a tang server",
             args=[
                 ("pool_name", dict(action="store", help="Pool name")),
-                (
-                    "key_description",
-                    dict(
-                        action="store",
-                        help="Description of key in kernel keyring used by this pool",
-                    ),
-                ),
                 ("url", dict(action="store", help="URL of tang server")),
             ],
             mut_ex_args=[
@@ -66,13 +59,6 @@
             help="Bind using TPM2",
             args=[
                 ("pool_name", dict(action="store", help="Pool name")),
-                (
-                    "key_description",
-                    dict(
-                        action="store",
-                        help="Description of key in kernel keyring used by this pool",
-                    ),
-                ),
             ],
             func=TopActions.bind_tpm,
         ),


Test patch:
diff --git a/tests/whitebox/integration/pool/test_bind.py b/tests/whitebox/integration/pool/test_bind.py
index 1108020fa..80619feda 100644
--- a/tests/whitebox/integration/pool/test_bind.py
+++ b/tests/whitebox/integration/pool/test_bind.py
@@ -46,7 +46,6 @@ def test_bind_when_unencrypted_tang(self):
         command_line = self._MENU + [
             "nbde",
             self._POOLNAME,
-            "fake_key",
             "URL",
             "--thumbprint",
             "fake thumbprint",
@@ -60,7 +59,6 @@ def test_bind_when_unencrypted_tang_trust(self):
         command_line = self._MENU + [
             "nbde",
             self._POOLNAME,
-            "fake_key",
             "URL",
             "--trust-url",
         ]
@@ -73,7 +71,6 @@ def test_bind_when_unencrypted_tpm(self):
         command_line = self._MENU + [
             "tpm2",
             self._POOLNAME,
-            "fake_key",
         ]
         self.check_error(StratisCliEngineError, command_line, _ERROR)
 
@@ -118,12 +115,10 @@ def test_bind_when_bound(self):
         command_line = self._MENU + [
             "tpm2",
             self._POOLNAME,
-            "fake_key",
         ]
         RUNNER(command_line)
         command_line = self._MENU + [
             "tpm2",
             self._POOLNAME,
-            "fake_key",
         ]
         self.check_error(StratisCliNoChangeError, command_line, _ERROR)
diff --git a/tests/whitebox/integration/pool/test_unbind.py b/tests/whitebox/integration/pool/test_unbind.py
index 73c7c8210..79d776e28 100644
--- a/tests/whitebox/integration/pool/test_unbind.py
+++ b/tests/whitebox/integration/pool/test_unbind.py
@@ -97,7 +97,6 @@ def test_unbind_when_bound(self):
             "bind",
             "nbde",
             self._POOLNAME,
-            "fake_key",
             "URL",
             "--trust-url",
         ]