[Libguestfs] [libguestfs-common PATCH v2 02/12] mltools/tools_utils: remove unused function "key_store_to_cli"

Laszlo Ersek lersek at redhat.com
Thu Jun 30 12:20:18 UTC 2022


Function "key_store_to_cli" was introduced in commit 310ffe7e507e
("mltools: Add key_store_to_cli", 2021-09-21), and put to use in virt-v2v
commit cff4514927b3 ("v2v: Pass --key parameters through to the input
helper", 2021-09-21).

However, the function has not been in use since virt-v2v commit
724ecb5e887e ("input: Turn helper into an OCaml module", 2021-12-02);
remove it now.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
Reviewed-by: Richard W.M. Jones <rjones at redhat.com>
---

Notes:
    v2:
    - pick up Rich's R-b

 mltools/tools_utils.mli |  8 --------
 mltools/tools_utils.ml  | 10 ----------
 2 files changed, 18 deletions(-)

diff --git a/mltools/tools_utils.mli b/mltools/tools_utils.mli
index 501830065038..8d9af7a0a661 100644
--- a/mltools/tools_utils.mli
+++ b/mltools/tools_utils.mli
@@ -101,18 +101,10 @@ val create_standard_options : Getopt.speclist -> ?anon_fun:Getopt.anon_fun -> ?k
     which allows another tool to run this tool and change the program
     name used in error messages.
 
     Returns a new {!cmdline_options} structure. *)
 
-val key_store_to_cli : key_store -> string list
-(** Convert a {!key_store} object back to a list of command line
-    options, essentially undoing the effect of Getopt parsing.
-    This is used in virt-v2v to pass the keystore to helpers.
-    It is not particularly secure, especially if you use the
-    [:key:] selector, although not any less secure than passing
-    them via the command line in the first place. *)
-
 val external_command : ?echo_cmd:bool -> string -> string list
 (** Run an external command, slurp up the output as a list of lines.
 
     [echo_cmd] specifies whether to output the full command on verbose
     mode, and it's on by default. *)
diff --git a/mltools/tools_utils.ml b/mltools/tools_utils.ml
index 695fda7e548c..8508534e16ee 100644
--- a/mltools/tools_utils.ml
+++ b/mltools/tools_utils.ml
@@ -418,20 +418,10 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false)
   let argspec = !argspec in
 
   let getopt = Getopt.create argspec ?anon_fun usage_msg in
   { getopt; ks; debug_gc }
 
-let key_store_to_cli { keys } =
-  Hashtbl.fold (
-    fun k v acc ->
-      let arg =
-        match v with
-        | KeyString s -> sprintf "%s:key:%s" k s
-        | KeyFileName f -> sprintf "%s:file:%s" k f in
-      "--key" :: arg :: acc
-  ) keys []
-
 (* Run an external command, slurp up the output as a list of lines. *)
 let external_command ?(echo_cmd = true) cmd =
   if echo_cmd then
     debug "%s" cmd;
   let chan = Unix.open_process_in cmd in
-- 
2.19.1.3.g30247aa5d201




More information about the Libguestfs mailing list